MCPcopy Create free account
hub / github.com/StrongPC123/Far-Cry-1-Source-Full / UpdateOrCreateEntry

Method UpdateOrCreateEntry

ResourceCompiler/CfgFile.cpp:142–167  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140
141
142void CfgFile::UpdateOrCreateEntry( const char *inszSection, const char *inszKey, const char *inszValue )
143{
144 Section *sec = FindSection( inszSection ); assert(sec);
145
146 for(std::list<Entry>::iterator it = sec->entries.begin(); it != sec->entries.end(); ++it)
147 {
148 if(stricmp(it->key.GetString(),inszKey) == 0) // Key found
149 if(!it->IsComment()) // update key
150 {
151 if(it->value==inszValue)
152 return;
153
154 it->value=inszValue;
155 m_modified=true;
156 return;
157 }
158 }
159
160 // Create new key
161 Entry entry;
162 entry.key = inszKey;
163 entry.value = inszValue;
164
165 sec->entries.push_back(entry);
166 m_modified=true;
167}
168
169
170

Callers 1

Calls 6

IsCommentMethod · 0.80
stricmpFunction · 0.50
beginMethod · 0.45
endMethod · 0.45
GetStringMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected