Home » Extra libraries, Code snippets, applications etc. » U++ users applications in progress and useful code snippets, including reference examples! » SetLineKeyValue - in memory (a helper fn to set key/value through regular String - ini like)
Re: SetLineKeyValue - in memory [message #47920 is a reply to message #47907] |
Mon, 24 April 2017 10:42 |
luoganda
Messages: 196 Registered: November 2016
|
Experienced Member |
|
|
These can be used when info is known to be contignous,
errline is just an errorlike func PromptOK can be used instead of it
All are readOnly funcs
inline bool SLKVSkipEmpty(StringStream &ss){
bool is=0;
while(!ss.IsEof()&&(ss.Peek()=='\n'||ss.Peek()=='\r'||ss.Peek()==';'||*(word*)ss.PeekPtr(2)==*(word*)"//")){
is=1;ss.GetLine();
}
return is;
}
inline String SLKVKey(StringStream &ss,bool withEqSign=true){
String ln=ss.GetLine();
int i=ln.Find('=');if(i==-1){if(withEqSign){errline(el,"char '=' not found near %s",~ln);return String::GetVoid();}}else ln=ln.Mid(0,i);
return ln;
}
inline String SLKVValue(StringStream &ss){
String ln=ss.GetLine();
int i=ln.Find('=');if(i==-1){errline(el,"char '=' not found near %s",~ln);return String::GetVoid();}
return ln.Mid(i+1);
}
inline bool SLKVKeyValue(StringStream &ss,String& key,String& val,bool withEqSign=true){
key=val="";String ln=ss.GetLine();
int i=ln.Find('=');if(i==-1){if(withEqSign){errline(el,"char '=' not found near %s",~ln);return false;}key=ln;return true;}
key=ln.Mid(0,i); val=ln.Mid(i+1);
return true;
}
[Updated on: Tue, 25 April 2017 23:09] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Mon Apr 29 03:47:11 CEST 2024
Total time taken to generate the page: 0.04642 seconds
|