当前位置: 首页>>代码示例>>C++>>正文


C++ JSONElement类代码示例

本文整理汇总了C++中JSONElement的典型用法代码示例。如果您正苦于以下问题:C++ JSONElement类的具体用法?C++ JSONElement怎么用?C++ JSONElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了JSONElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ToJSON

JSONElement PluginInfoArray::ToJSON() const
{
    JSONElement el = JSONElement::createObject(GetName());
    el.addProperty("disabledPlugins", m_disabledPlugins);
    
    JSONElement arr = JSONElement::createArray("installed-plugins");
    PluginInfo::PluginMap_t::const_iterator iter = m_plugins.begin();
    for( ; iter != m_plugins.end(); ++iter ) {
        arr.arrayAppend( iter->second.ToJSON() );
    }
    el.append(arr);
    return el;
}
开发者ID:05storm26,项目名称:codelite,代码行数:13,代码来源:plugindata.cpp

示例2: FromJSON

void FindReplaceData::FromJSON(const JSONElement& json)
{
    m_findString = json.namedObject("m_findString").toArrayString();
    m_replaceString = json.namedObject("m_replaceString").toArrayString();
    m_flags = json.namedObject("m_flags").toSize_t(m_flags);

    if(json.hasNamedObject("m_lookIn")) {
        m_searchPaths = json.namedObject("m_lookIn").toArrayString();
    } else {
        m_searchPaths.Add(SEARCH_IN_WORKSPACE_FOLDER);
    }

    m_encoding = json.namedObject("m_encoding").toString(m_encoding);
    m_fileMask = json.namedObject("m_fileMask").toArrayString();
    m_selectedMask = json.namedObject("m_selectedMask").toString(m_selectedMask);

    long max_value = clConfig::Get().Read(kConfigMaxItemsInFindReplaceDialog, 15);

    TruncateArray(m_searchPaths, (size_t)max_value);
    TruncateArray(m_replaceString, (size_t)max_value);
    TruncateArray(m_findString, (size_t)max_value);

    if(m_fileMask.IsEmpty()) {
        m_fileMask.Add("*.c;*.cpp;*.cxx;*.cc;*.h;*.hpp;*.inc;*.mm;*.m;*.xrc");
        m_selectedMask = m_fileMask.Item(0);
    }
}
开发者ID:lpc1996,项目名称:codelite,代码行数:27,代码来源:findreplacedlg.cpp

示例3: root

void ColoursAndFontsManager::LoadJSON(const wxFileName& path)
{
    if(!path.FileExists()) return;

    JSONRoot root(path);
    JSONElement arr = root.toElement();
    int arrSize = arr.arraySize();
    CL_DEBUG("Loading JSON file: %s (contains %d lexers)", path.GetFullPath(), arrSize);
    for(int i = 0; i < arrSize; ++i) {
        JSONElement json = arr.arrayItem(i);
        DoAddLexer(json);
    }
    CL_DEBUG("Loading JSON file...done");
}
开发者ID:anatooly,项目名称:codelite,代码行数:14,代码来源:ColoursAndFontsManager.cpp

示例4: CreateFilesArray

JSONElement clTernServer::CreateFilesArray(IEditor* editor, bool forDelete)
{
    const wxString fileContent = editor->GetCtrl()->GetText();
    JSONElement files = JSONElement::createArray("files");

    JSONElement file = JSONElement::createObject();
    files.arrayAppend(file);

    wxString filename;
    if(!m_workingDirectory.IsEmpty()) {
        wxFileName fn(editor->GetFileName());
        fn.MakeRelativeTo(m_workingDirectory);
        filename = fn.GetFullPath();
    } else {
        filename = editor->GetFileName().GetFullName();
    }

    if(forDelete) {
        file.addProperty("type", wxString("delete"));
        file.addProperty("name", filename);

    } else {
        file.addProperty("type", wxString("full"));
        file.addProperty("name", filename);
        file.addProperty("text", fileContent);
    }
    return files;
}
开发者ID:anatooly,项目名称:codelite,代码行数:28,代码来源:clTernServer.cpp

示例5: FromJSON

void wxCrafterCBSettings::FromJSON(const JSONElement& json)
{
    m_wxcPath = json.namedObject(wxT("m_wxcPath")).toString(m_wxcPath);
    
    // Read the settings dialog size and pos
    wxPoint settingsDlgPt  ( wxDefaultPosition );
    wxSize  settingsDlgSize( wxDefaultSize     );
    
    if ( json.hasNamedObject(wxT("m_settingsDialogRect.size")) && json.hasNamedObject(wxT("m_settingsDialogRect.point")) ) {
        settingsDlgSize = json.namedObject(wxT("m_settingsDialogRect.size")).toSize();
        settingsDlgPt   = json.namedObject(wxT("m_settingsDialogRect.point")).toPoint();
        m_settingsDialogRect = wxRect(settingsDlgPt, settingsDlgSize);
    }
}
开发者ID:erdincay,项目名称:wxCrafterCB,代码行数:14,代码来源:wxCrafterCBSettings.cpp

示例6: CreateLocation

JSONElement clTernServer::CreateLocation(wxStyledTextCtrl* ctrl, int pos)
{
    if(pos == wxNOT_FOUND) {
        pos = ctrl->GetCurrentPos();
    }
    int lineNo = ctrl->LineFromPosition(pos);
    JSONElement loc = JSONElement::createObject("end");
    loc.addProperty("line", lineNo);

    // Pass the column
    int lineStartPos = ctrl->PositionFromLine(lineNo);
    pos = pos - lineStartPos;
    loc.addProperty("ch", pos);
    return loc;
}
开发者ID:anatooly,项目名称:codelite,代码行数:15,代码来源:clTernServer.cpp

示例7: append

JSONElement& JSONElement::addProperty(const wxString& name, const JSONElement::wxStringMap_t& stringMap)
{
    if(!_json) return *this;

    JSONElement arr = JSONElement::createArray(name);
    JSONElement::wxStringMap_t::const_iterator iter = stringMap.begin();
    for(; iter != stringMap.end(); ++iter) {
        JSONElement obj = JSONElement::createObject();
        obj.addProperty("key", iter->first);
        obj.addProperty("value", iter->second);
        arr.arrayAppend(obj);
    }
    append(arr);
    return *this;
}
开发者ID:capturePointer,项目名称:codelite,代码行数:15,代码来源:json_node.cpp

示例8: ToJSON

JSONElement LLDBVariable::ToJSON() const
{
    JSONElement json = JSONElement::createObject();
    json.addProperty("m_name", m_name);
    json.addProperty("m_value", m_value);
    json.addProperty("m_summary", m_summary);
    json.addProperty("m_type", m_type);
    json.addProperty("m_valueChanged", m_valueChanged);
    json.addProperty("m_lldbId", m_lldbId);
    json.addProperty("m_hasChildren", m_hasChildren);
    json.addProperty("m_isWatch", m_isWatch);
    return json;
}
开发者ID:GaganJotSingh,项目名称:codelite,代码行数:13,代码来源:LLDBVariable.cpp

示例9: root

void clTernServer::ProcessOutput(const wxString& output, wxCodeCompletionBoxEntry::Vec_t& entries)
{
    // code completion response:
    // ================================
    // {
    // "start": 78,
    // "end": 78,
    // "isProperty": true,
    // "isObjectKey": false,
    // "completions": [
    //   {
    //     "name": "concat",
    //     "type": "fn(other: [?])",
    //     "doc": "Returns a new array comprised of this array joined with other array(s) and/or value(s).",
    //     "url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/concat"
    //   },
    //   {
    //     "name": "every",
    //     "type": "fn(test: fn(elt: ?, i: number) -> bool, context?: ?) -> bool",
    //     "doc": "Tests whether all elements in the array pass the test implemented by the provided function.",
    //     "url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/every"
    //   }]}

    entries.clear();

    JSONRoot root(output);
    JSONElement completionsArr = root.toElement().namedObject("completions");
    for(int i = 0; i < completionsArr.arraySize(); ++i) {
        JSONElement item = completionsArr.arrayItem(i);
        wxString name = item.namedObject("name").toString();
        wxString doc = item.namedObject("doc").toString();
        wxString url = item.namedObject("url").toString();
        bool isKeyword = item.namedObject("isKeyword").toBool();
        int imgId;
        if(!isKeyword) {
            doc = this->PrepareDoc(doc, url);
            wxString type = item.namedObject("type").toString();
            wxString sig, ret;
            ProcessType(type, sig, ret, imgId);

            // Remove double quotes
            name.StartsWith("\"", &name);
            name.EndsWith("\"", &name);

            wxCodeCompletionBoxEntry::Ptr_t entry = wxCodeCompletionBoxEntry::New(name /* + sig*/, imgId);
            entry->SetComment(doc);
            entries.push_back(entry);

        } else {
            imgId = 17; // keyword
            wxCodeCompletionBoxEntry::Ptr_t entry = wxCodeCompletionBoxEntry::New(name, imgId);
            entries.push_back(entry);
        }
    }
}
开发者ID:anatooly,项目名称:codelite,代码行数:55,代码来源:clTernServer.cpp

示例10: fn

clKeyboardBindingConfig& clKeyboardBindingConfig::Load()
{
    wxFileName fn(clStandardPaths::Get().GetUserDataDir(), "keybindings.conf");
    fn.AppendDir("config");
    if(!fn.Exists()) return *this;

    m_bindings.clear();
    JSONRoot root(fn);

    {
        JSONElement menus = root.toElement().namedObject("menus");
        int arrSize = menus.arraySize();
        for(int i = 0; i < arrSize; ++i) {
            JSONElement item = menus.arrayItem(i);
            MenuItemData binding;
            binding.action = item.namedObject("description").toString();
            binding.accel = item.namedObject("accelerator").toString();
            binding.parentMenu = item.namedObject("parentMenu").toString();
            binding.resourceID = item.namedObject("resourceID").toString();
            if(binding.resourceID == "text_word_complete") {
                // This entry was moved from Word Completion plugin to CodeLite Edit menu entry
                binding.resourceID = "simple_word_completion";
                binding.parentMenu = "Edit";
                binding.action = "Complete Word";
            } else if(binding.resourceID == "complete_word") {
                // The "action" was changed
                binding.action = "Code Complete";
            } else if(binding.resourceID == "word_complete") {
                binding.resourceID = "complete_word";
            }
            m_bindings.insert(std::make_pair(binding.resourceID, binding));
        }
    }
    return *this;
}
开发者ID:lpc1996,项目名称:codelite,代码行数:35,代码来源:clKeyboardBindingConfig.cpp

示例11: ToJSON

void GitCommandsEntries::ToJSON(JSONElement& arr) const
{
    JSONElement obj = JSONElement::createObject();
    obj.addProperty("m_commandName", m_commandName);
    obj.addProperty("m_lastUsed", m_lastUsed);

    JSONElement commandsArr = JSONElement::createArray("m_commands");
    obj.append(commandsArr);

    vGitLabelCommands_t::const_iterator iter = m_commands.begin();
    for(; iter != m_commands.end(); ++iter) {
        JSONElement e = JSONElement::createObject();
        e.addProperty("label", iter->label);
        e.addProperty("command", iter->command);
        commandsArr.arrayAppend(e);
    }
    arr.arrayAppend(obj);
}
开发者ID:05storm26,项目名称:codelite,代码行数:18,代码来源:gitentry.cpp

示例12: FromJSON

void LLDBVariable::FromJSON(const JSONElement& json)
{
    m_name = json.namedObject("m_name").toString();
    m_value = json.namedObject("m_value").toString();
    m_summary = json.namedObject("m_summary").toString();
    m_type = json.namedObject("m_type").toString();
    m_valueChanged = json.namedObject("m_valueChanged").toBool(false);
    m_lldbId = json.namedObject("m_lldbId").toInt();
    m_hasChildren = json.namedObject("m_hasChildren").toBool(false);
    m_isWatch = json.namedObject("m_isWatch").toBool(m_isWatch);
}
开发者ID:GaganJotSingh,项目名称:codelite,代码行数:11,代码来源:LLDBVariable.cpp

示例13: SetFilename

void LLDBBreakpoint::FromJSON(const JSONElement& json)
{
    m_children.clear();
    m_id = json.namedObject("m_id").toInt(wxNOT_FOUND);
    m_type = json.namedObject("m_type").toInt(kInvalid);
    m_name = json.namedObject("m_name").toString();
    SetFilename(json.namedObject("m_filename").toString());
    m_lineNumber = json.namedObject("m_lineNumber").toInt();
    JSONElement arr = json.namedObject("m_children");
    for(int i=0; i<arr.arraySize(); ++i) {
        LLDBBreakpoint::Ptr_t bp(new LLDBBreakpoint() );
        bp->FromJSON( arr.arrayItem(i) );
        m_children.push_back( bp );
    }
}
开发者ID:lpc1996,项目名称:codelite,代码行数:15,代码来源:LLDBBreakpoint.cpp

示例14: ToJSON

JSONElement PHPConfigurationData::ToJSON() const
{
    JSONElement e = JSONElement::createObject(GetName());
    e.addProperty("m_includePaths", m_includePaths);
    e.addProperty("m_phpExe", m_phpExe);
    e.addProperty("m_errorReporting", m_errorReporting);
    e.addProperty("m_xdebugPort", m_xdebugPort);
    e.addProperty("m_ccIncludePath", m_ccIncludePath);
    e.addProperty("m_flags", m_flags);
    e.addProperty("m_xdebugIdeKey", m_xdebugIdeKey);
    return e;
}
开发者ID:LoviPanda,项目名称:codelite,代码行数:12,代码来源:php_configuration_data.cpp

示例15: fp

wxFileName CompilationDatabase::ConvertCodeLiteCompilationDatabaseToCMake(const wxFileName& compile_file)
{
    wxFFile fp(compile_file.GetFullPath(), wxT("rb"));
    if( fp.IsOpened() ) {
        wxString content;
        fp.ReadAll(&content, wxConvUTF8);

        if( content.IsEmpty() )
            return wxFileName();
        
        JSONRoot root(cJSON_Array);
        JSONElement arr = root.toElement();
        wxArrayString lines = ::wxStringTokenize(content, "\n\r", wxTOKEN_STRTOK);
        for(size_t i=0; i<lines.GetCount(); ++i) {
            wxArrayString parts = ::wxStringTokenize(lines.Item(i), wxT("|"), wxTOKEN_STRTOK);
            if( parts.GetCount() != 3 )
                continue;

            wxString file_name = wxFileName(parts.Item(0).Trim().Trim(false)).GetFullPath();
            wxString cwd       = parts.Item(1).Trim().Trim(false);
            wxString cmp_flags = parts.Item(2).Trim().Trim(false);

            JSONElement element = JSONElement::createObject();
            element.addProperty("directory", cwd);
            element.addProperty("command",   cmp_flags);
            element.addProperty("file",      file_name);
            arr.arrayAppend( element );
        }
        
        wxFileName fn(compile_file.GetPath(), "compile_commands.json");
        root.save( fn );
        // Delete the old file
        {
            wxLogNull nl;
            fp.Close();
            if ( compile_file.Exists() ) {
                ::wxRemoveFile( compile_file.GetFullPath() );
            }
        }
        return fn;
    }
    return wxFileName();
}
开发者ID:linweixin,项目名称:codelite,代码行数:43,代码来源:compilation_database.cpp


注:本文中的JSONElement类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。