Changeset 708 for code/branches/FICN/src/orxonox/core/Language.cc
- Timestamp:
- Dec 28, 2007, 10:30:29 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/FICN/src/orxonox/core/Language.cc
r704 r708 28 28 #include <fstream> 29 29 30 #include "CoreIncludes.h" 30 31 #include "Language.h" 31 #include "CoreIncludes.h"32 32 33 33 namespace orxonox … … 36 36 // ### LanguageEntry ### 37 37 // ############################### 38 LanguageEntry::LanguageEntry(const std::string& fallbackEntry)38 LanguageEntry::LanguageEntry(const String& fallbackEntry) 39 39 { 40 40 RegisterRootObject(LanguageEntry); … … 44 44 } 45 45 46 void LanguageEntry::setTranslation(const std::string& translation)46 void LanguageEntry::setTranslation(const String& translation) 47 47 { 48 48 if (translation.compare("") != 0) … … 52 52 } 53 53 54 void LanguageEntry::setDefault(const std::string& fallbackEntry)54 void LanguageEntry::setDefault(const String& fallbackEntry) 55 55 { 56 56 if (this->translatedEntry_.compare(this->fallbackEntry_) == 0) … … 85 85 } 86 86 87 void Language::createEntry(const LanguageEntryName& name, const std::string& entry)87 void Language::createEntry(const LanguageEntryName& name, const String& entry) 88 88 { 89 89 if (!this->languageEntries_[name]) … … 99 99 } 100 100 101 void Language::addEntry(const LanguageEntryName& name, const std::string& entry)102 { 103 std::map< std::string, LanguageEntry*>::const_iterator it = this->languageEntries_.find(name);101 void Language::addEntry(const LanguageEntryName& name, const String& entry) 102 { 103 std::map<String, LanguageEntry*>::const_iterator it = this->languageEntries_.find(name); 104 104 if (!it->second) 105 105 this->createEntry(name, entry); … … 112 112 } 113 113 114 const std::string& Language::getTranslation(const LanguageEntryName& name) const115 { 116 std::map< std::string, LanguageEntry*>::const_iterator it = this->languageEntries_.find(name);114 const String& Language::getTranslation(const LanguageEntryName& name) const 115 { 116 std::map<String, LanguageEntry*>::const_iterator it = this->languageEntries_.find(name); 117 117 if (it->second) 118 118 return it->second->getTranslation(); … … 124 124 } 125 125 126 const std::string Language::getFileName(const std::string& language)127 { 128 return std::string("translation_" + language + ".lang");126 const String Language::getFileName(const String& language) 127 { 128 return String("translation_" + language + ".lang"); 129 129 } 130 130 … … 154 154 { 155 155 file.getline(line, 1024); 156 std::string lineString = std::string(line);156 String lineString = String(line); 157 157 if (lineString.compare("") != 0) 158 158 { … … 190 190 { 191 191 file.getline(line, 1024); 192 std::string lineString = std::string(line);192 String lineString = String(line); 193 193 if (lineString.compare("") != 0) 194 194 { … … 196 196 if (pos < lineString.size() && lineString.size() >= 3) 197 197 { 198 std::map< std::string, LanguageEntry*>::const_iterator it = this->languageEntries_.find(lineString.substr(0, pos));198 std::map<String, LanguageEntry*>::const_iterator it = this->languageEntries_.find(lineString.substr(0, pos)); 199 199 if (it->second) 200 200 it->second->setTranslation(lineString.substr(pos + 1));
Note: See TracChangeset
for help on using the changeset viewer.