Open
Conversation
Contributor
|
update resolving conflicts and avoid repition one call the other |
…me. Return false on failure to parse a config file line (which isn't a comment or empty), rather than silently ignoring it
2675bb6 to
5005b7a
Compare
Contributor
Author
|
Done, tested with the following code: // g++ -g storetest.cpp -I include/ -L lib/ -lStore -o sstest
#include <iostream>
#include "Store.h"
using namespace ToolFramework;
int main(){
bool ok=true;
Store s1;
std::cout<<"initing file"<<std::endl;
ok = s1.Initialise("testconfig.txt");
std::cout<<"ok = "<<ok<<", contents: "<<std::endl;
s1.Print();
std::cout<<"---"<<std::endl;
std::stringstream ss;
std::string tmp{
"var1 99 \n\
var2 3.33 \n\
var3 potato \n\
\n\
var4 cat dog fish \n\
var5 onemore \n\
#commentline \n\
var6 trailingcomment # potato \n\
var7 lastone \n"
};
std::clog<<"config string is:\n'"<<tmp<<"'"<<std::endl;
ss.str(tmp);
Store s2;
std::cout<<"initing stringstream"<<std::endl;
ok = s2.Initialise(ss);
std::cout<<"ok = "<<ok<<", contents: "<<std::endl;
s2.Print();
std::cout<<"---"<<std::endl;
return 0;
}and var1 99
var2 3.33
var3 potato
var4 cat dog fish
var5 onemore
#commentline
var6 trailingcomment # potato
var7 lastone
with output as follows: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
add Store::Initialise based on stringstream as well as string filename. Return false on failure to parse a config file line (which isn't a comment or empty), rather than silently ignoring it