7772 {
7773 std::string line;
7774 std::string section = "default";
7775
7776 std::vector<ConfigItem> output;
7778 char aStart = (defaultArray) ?
'[' :
arrayStart;
7779 char aEnd = (defaultArray) ?
']' :
arrayEnd;
7781
7782 while(getline(input, line)) {
7783 std::vector<std::string> items_buffer;
7785
7787 std::size_t
len = line.length();
7788 if(
len > 1 && line.front() ==
'[' && line.back() ==
']') {
7789 if(section != "default") {
7790
7791 output.emplace_back();
7793 output.back().name = "--";
7794 }
7795 section = line.substr(1,
len - 2);
7796
7797 if(section.size() > 1 && section.front() == '[' && section.back() == ']') {
7798 section = section.substr(1, section.size() - 2);
7799 }
7801 section = "default";
7802 } else {
7804 }
7805 continue;
7806 }
7808 continue;
7809 }
7810
7811 if(line.front() ==
';' || line.front() ==
'#' || line.front() ==
commentChar) {
7812 continue;
7813 }
7814
7815
7817 if(pos != std::string::npos) {
7820 if(item.size() > 1 && item.front() == aStart && item.back() == aEnd) {
7821 items_buffer = detail::split_up(item.substr(1, item.length() - 2), aSep);
7822 } else if(defaultArray && item.find_first_of(aSep) != std::string::npos) {
7823 items_buffer = detail::split_up(item, aSep);
7824 } else if(defaultArray && item.find_first_of(' ') != std::string::npos) {
7825 items_buffer = detail::split_up(item);
7826 } else {
7827 items_buffer = {item};
7828 }
7829 } else {
7831 items_buffer = {"true"};
7832 }
7833 if(
name.find(
'.') == std::string::npos) {
7835 }
7836
7837 for(auto &it : items_buffer) {
7839 }
7840
7842
7843 if(!output.empty() &&
name == output.back().name && parents == output.back().parents) {
7844 output.back().inputs.insert(output.back().inputs.end(), items_buffer.begin(), items_buffer.end());
7845 } else {
7846 output.emplace_back();
7847 output.back().parents = std::move(parents);
7848 output.back().name = std::move(
name);
7849 output.back().inputs = std::move(items_buffer);
7850 }
7851 }
7852 if(section != "default") {
7853
7854 std::string ename;
7855 output.emplace_back();
7857 output.back().name = "--";
7858 while(output.back().parents.size() > 1) {
7859 output.push_back(output.back());
7860 output.back().parents.pop_back();
7861 }
7862 }
7863 return output;
7864}
char valueDelimiter
the character used separate the name from the value
std::string & remove_quotes(std::string &str)
remove quotes at the front and back of a string either '"' or '\''
std::string trim_copy(const std::string &str)
Make a copy of the string and then trim it.
std::string & trim(std::string &str)
Trim whitespace from string.
void checkParentSegments(std::vector< ConfigItem > &output, const std::string ¤tSection)
assuming non default segments do a check on the close and open of the segments in a configItem struct...
std::vector< std::string > generate_parents(const std::string §ion, std::string &name)
std::string to_lower(std::string str)
Return a lower case version of a string.