src/FaustSawtooth.cpp
static bool parseJson(const char*& p,
                      std::map<std::string, std::pair<std::string, double> >& metaDatas0,
                      std::map<std::string, std::string>& metaDatas1,
                      std::map<std::string, std::vector<std::string> >& metaDatas2,
                      std::vector<itemInfo>& uiItems)
{
    parseChar(p, '{');
    
    do {
        std::string key;
        std::string value;
        double dbl = 0;
        std::vector<std::string> items;
        if (parseGlobalMetaData(p, key, value, dbl, metaDatas1, items)) {
            if (key != "meta") {
                // keep "name", "inputs", "outputs" key/value pairs
                if (items.size() > 0) {
                    metaDatas2[key] = items;
                    items.clear();
                } else if (value != "") {
                    metaDatas0[key].first = value;
                } else {
                    metaDatas0[key].second = dbl;
                }
            }
        } else if (key == "ui") {
            int numItems = 0;
            parseChar(p, '[') && parseUI(p, uiItems, numItems);
        }
    } while (tryChar(p, ','));
    
    return parseChar(p, '}');
}
// ---------------------------------------------------------------------
// Parse full JSON record describing a JSON/Faust interface :
// {"metadatas": "...", "ui": [{ "type": "...", "label": "...", "items": [...], "address": "...","init": "...", "min": "...", "max": "...","step": "..."}]}
//
// and store the result in map Metadatas and vector containing the items of the interface. Returns true if parsing was successfull.
/// ---------------------------------------------------------------------


and store the result in map Metadatas and vector containing the items of the interface. Returns true if parsing was successfull.
and store the result in map Metadatas and vector containing the items of the interface . Returns true if parsing was successfull .
static bool parseJson(const char*& p,
                      std::map<std::string, std::pair<std::string, double> >& metaDatas0,
                      std::map<std::string, std::string>& metaDatas1,
                      std::map<std::string, std::vector<std::string> >& metaDatas2,
                      std::vector<itemInfo>& uiItems)
{
    parseChar(p, '{');
    do {
        std::string key;
        std::string value;
        double dbl = 0;
        std::vector<std::string> items;
        if (parseGlobalMetaData(p, key, value, dbl, metaDatas1, items)) {
            if (key != "meta") {
                if (items.size() > 0) {
                    metaDatas2[key] = items;
                    items.clear();
                } else if (value != "") {
                    metaDatas0[key].first = value;
                } else {
                    metaDatas0[key].second = dbl;
                }
            }
        } else if (key == "ui") {
            int numItems = 0;
            parseChar(p, '[') && parseUI(p, uiItems, numItems);
        }
    } while (tryChar(p, ','));
    return parseChar(p, '}');
}
static bool parseJson ( const char * & p , std :: map < std :: string , std :: pair < std :: string , double > > & metaDatas0 , std :: map < std :: string , std :: string > & metaDatas1 , std :: map < std :: string , std :: vector < std :: string > > & metaDatas2 , std :: vector < itemInfo > & uiItems ) { parseChar ( p , ' ' ) ; do { std :: string key ; std :: string value ; double dbl = 0 ; std :: vector < std :: string > items ; if ( parseGlobalMetaData ( p , key , value , dbl , metaDatas1 , items ) ) { if ( key != " " ) { if ( items . size ( ) > 0 ) { metaDatas2 [ key ] = items ; items . clear ( ) ; } else if ( value != " " ) { metaDatas0 [ key ] . first = value ; } else { metaDatas0 [ key ] . second = dbl ; } } } else if ( key == " " ) { int numItems = 0 ; parseChar ( p , ' ' ) && parseUI ( p , uiItems , numItems ) ; } } while ( tryChar ( p , ' ' ) ) ; return parseChar ( p , ' ' ) ; }
Parse full JSON record describing a JSON/Faust interface :
{"metadatas": "...", "ui": [{ "type": "...", "label": "...", "items": [...], "address": "...","init": "...", "min": "...", "max": "...","step": "..."}]}
Parse full JSON record describing a JSON / Faust interface : { " metadatas " : " ... " " ui " : [ { " type " : " ... " " label " : " ... " " items " : [ ... ] " address " : " ... " " init " : " ... " " min " : " ... " " max " : " ... " " step " : " ... " } ] }
// keep "name", "inputs", "outputs" key/value pairs