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


C++ JSONElement::arraySize方法代码示例

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


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

示例1: FromJSON

void LLDBReply::FromJSON(const JSONElement& json)
{
    m_replyType = json.namedObject("m_replyType").toInt(kReplyTypeInvalid);
    m_interruptResaon = json.namedObject("m_stopResaon").toInt(kInterruptReasonNone);
    m_line = json.namedObject("m_line").toInt(wxNOT_FOUND);
    m_filename = json.namedObject("m_filename").toString();
    m_lldbId = json.namedObject("m_lldbId").toInt();
    m_expression = json.namedObject("m_expression").toString();
    m_debugSessionType = json.namedObject("m_debugSessionType").toInt(kDebugSessionTypeNormal);
    m_text = json.namedObject("m_text").toString();
    
    m_breakpoints.clear();
    JSONElement arr = json.namedObject("m_breakpoints");
    for(int i = 0; i < arr.arraySize(); ++i) {
        LLDBBreakpoint::Ptr_t bp(new LLDBBreakpoint());
        bp->FromJSON(arr.arrayItem(i));
        m_breakpoints.push_back(bp);
    }

    m_variables.clear();
    JSONElement localsArr = json.namedObject("m_locals");
    m_variables.reserve(localsArr.arraySize());
    for(int i = 0; i < localsArr.arraySize(); ++i) {
        LLDBVariable::Ptr_t variable(new LLDBVariable());
        variable->FromJSON(localsArr.arrayItem(i));
        m_variables.push_back(variable);
    }

    m_backtrace.Clear();
    JSONElement backtrace = json.namedObject("m_backtrace");
    m_backtrace.FromJSON(backtrace);

    m_threads = LLDBThread::FromJSON(json, "m_threads");
}
开发者ID:292388900,项目名称:codelite,代码行数:34,代码来源:LLDBReply.cpp

示例2: ParseRefsArray

void NodeJSDebuggerPane::ParseRefsArray(const JSONElement& refs)
{
    int refsCount = refs.arraySize();
    for(int i = 0; i < refsCount; ++i) {
        JSONElement ref = refs.arrayItem(i);
        int handleId = ref.namedObject("handle").toInt();
        Handle h;
        h.type = ref.namedObject("type").toString();
        if(h.type == "undefined") {
            h.value = "undefined";
        } else if(h.type == "number" || h.type == "boolean") {
            h.value = ref.namedObject("text").toString();
        } else if(h.type == "string") {
            h.value << "\"" << ref.namedObject("text").toString() << "\"";
        } else if(h.type == "script" || h.type == "function") {
            h.value = ref.namedObject("name").toString();
        } else if(h.type == "null") {
            h.value = "null";
        } else if(h.type == "object") {
            h.value = "{...}";
            JSONElement props = ref.namedObject("properties");
            int propsCount = props.arraySize();
            for(int n = 0; n < propsCount; ++n) {
                JSONElement prop = props.arrayItem(n);
                wxString propName = prop.namedObject("name").toString();
                int propId = prop.namedObject("ref").toInt();
                h.properties.insert(std::make_pair(propId, propName));
            }
        }
        m_handles.insert(std::make_pair(handleId, h));
    }
}
开发者ID:huanghjb,项目名称:codelite,代码行数:32,代码来源:NodeJSDebuggerPane.cpp

示例3: FromJSON

void LexerConf::FromJSON(const JSONElement& json)
{
    m_name = json.namedObject("Name").toString();
    m_lexerId = json.namedObject("Id").toInt();
    m_themeName = json.namedObject("Theme").toString();
    if(json.hasNamedObject("Flags")) {
        m_flags = json.namedObject("Flags").toSize_t();
    } else {
        SetIsActive(json.namedObject("IsActive").toBool());
        SetUseCustomTextSelectionFgColour(json.namedObject("UseCustomTextSelFgColour").toBool());
        SetStyleWithinPreProcessor(json.namedObject("StylingWithinPreProcessor").toBool());
    }
    SetKeyWords(json.namedObject("KeyWords0").toString(), 0);
    SetKeyWords(json.namedObject("KeyWords1").toString(), 1);
    SetKeyWords(json.namedObject("KeyWords2").toString(), 2);
    SetKeyWords(json.namedObject("KeyWords3").toString(), 3);
    SetKeyWords(json.namedObject("KeyWords4").toString(), 4);
    SetFileSpec(json.namedObject("Extensions").toString());

    m_properties.clear();
    JSONElement properties = json.namedObject("Properties");
    int arrSize = properties.arraySize();
    for(int i = 0; i < arrSize; ++i) {
        // Construct a style property
        StyleProperty p;
        p.FromJSON(properties.arrayItem(i));
        m_properties.insert(std::make_pair(p.GetId(), p));
    }
}
开发者ID:HelloWangCheng,项目名称:codelite,代码行数:29,代码来源:lexer_configuration.cpp

示例4: ParseRef

NodeJSHandle NodeJSOuptutParser::ParseRef(const JSONElement& ref, std::map<int, NodeJSHandle>& handles)
{
    int handleId = ref.namedObject("handle").toInt();
    NodeJSHandle h;
    h.handleID = handleId;
    h.type = ref.namedObject("type").toString();
    if(h.type == "undefined") {
        h.value = "undefined";
    } else if(h.type == "number" || h.type == "boolean") {
        h.value = ref.namedObject("text").toString();
    } else if(h.type == "string") {
        h.value << "\"" << ref.namedObject("text").toString() << "\"";
    } else if(h.type == "script" || h.type == "function") {
        h.value = ref.namedObject("name").toString();
    } else if(h.type == "null") {
        h.value = "null";
    } else if(h.type == "object") {
        h.value = "{...}";
        JSONElement props = ref.namedObject("properties");
        int propsCount = props.arraySize();
        for(int n = 0; n < propsCount; ++n) {
            JSONElement prop = props.arrayItem(n);
            wxString propName = prop.namedObject("name").toString();
            int propId = prop.namedObject("ref").toInt();
            h.properties.insert(std::make_pair(propId, propName));
        }
    }
    handles.insert(std::make_pair(handleId, h));
    return h;
}
开发者ID:zhuxiaobai,项目名称:codelite,代码行数:30,代码来源:NodeJSOuptutParser.cpp

示例5: 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

示例6: FromJSON

void PHPWorkspace::FromJSON(const JSONElement& e)
{
    m_projects.clear();
    if(e.hasNamedObject("projects")) {
        PHPProject::Ptr_t firstProject;
        JSONElement projects = e.namedObject("projects");
        int count = projects.arraySize();
        for(int i = 0; i < count; ++i) {
            PHPProject::Ptr_t p(new PHPProject());
            wxString project_file = projects.arrayItem(i).toString();
            wxFileName fnProject(project_file);
            fnProject.MakeAbsolute(m_workspaceFile.GetPath());
            p->Load(fnProject);
            m_projects.insert(std::make_pair(p->GetName(), p));
            if(!firstProject) {
                firstProject = p;
            }
        }

        PHPProject::Ptr_t activeProject = GetActiveProject();
        if(!activeProject && firstProject) {
            // No active project found, mark the first project as active
            activeProject = firstProject;
            SetProjectActive(firstProject->GetName());
        }

        if(activeProject) {
            // Notify about active project been set
            clProjectSettingsEvent evt(wxEVT_ACTIVE_PROJECT_CHANGED);
            evt.SetProjectName(activeProject->GetName());
            evt.SetFileName(activeProject->GetFilename().GetFullPath());
            EventNotifier::Get()->AddPendingEvent(evt);
        }
    }
}
开发者ID:stahta01,项目名称:codelite,代码行数:35,代码来源:php_workspace.cpp

示例7: FromJSON

void GitEntry::FromJSON(const JSONElement& json)
{
    m_entries = json.namedObject("m_entries").toStringMap();
    wxString track, diff;
    track = json.namedObject("m_colourTrackedFile").toString();
    diff = json.namedObject("m_colourDiffFile").toString();
    m_pathGIT = json.namedObject("m_pathGIT").toString(m_pathGIT);
    m_pathGITK = json.namedObject("m_pathGITK").toString(m_pathGITK);
    m_flags = json.namedObject("m_flags").toSize_t(m_flags);
    m_gitDiffDlgSashPos = json.namedObject("m_gitDiffDlgSashPos").toInt(m_gitDiffDlgSashPos);
    m_gitConsoleSashPos = json.namedObject("m_gitConsoleSashPos").toInt(m_gitConsoleSashPos);
    m_gitCommitDlgHSashPos = json.namedObject("m_gitCommitDlgHSashPos").toInt(m_gitCommitDlgHSashPos);
    m_gitCommitDlgVSashPos = json.namedObject("m_gitCommitDlgVSashPos").toInt(m_gitCommitDlgVSashPos);

    // override the colour only if it is a valid colour
    if(!track.IsEmpty()) {
        m_colourTrackedFile = track;
    }
    if(!diff.IsEmpty()) {
        m_colourDiffFile = diff;
    }
    
    m_recentCommits = json.namedObject("m_recentCommits").toArrayString();
    
    // read the git commands
    JSONElement arrCommands = json.namedObject("Commands");
    for(int i = 0; i < arrCommands.arraySize(); ++i) {
        GitCommandsEntries entry;
        entry.FromJSON(arrCommands.arrayItem(i));
        m_commandsMap.insert(std::make_pair(entry.GetCommandname(), entry));
    }
}
开发者ID:05storm26,项目名称:codelite,代码行数:32,代码来源:gitentry.cpp

示例8: ProcessOutput

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

示例9: FromJSON

void LLDBBacktrace::FromJSON(const JSONElement& json)
{
    m_callstack.clear();
    m_threadId = json.namedObject("m_threadId").toInt(0);
    JSONElement arr = json.namedObject("m_callstack");
    for(int i=0; i<arr.arraySize(); ++i) {
        LLDBBacktrace::Entry entry;
        entry.FromJSON( arr.arrayItem(i) );
        m_callstack.push_back( entry );
    }
}
开发者ID:qioixiy,项目名称:codelite,代码行数:11,代码来源:LLDBBacktrace.cpp

示例10: FromJSON

void PluginInfoArray::FromJSON(const JSONElement& json)
{
    m_disabledPlugins = json.namedObject("disabledPlugins").toArrayString();
    m_plugins.clear();
    JSONElement arr = json.namedObject("installed-plugins");
    for(int i=0; i<arr.arraySize(); ++i) {
        PluginInfo pi;
        pi.FromJSON( arr.arrayItem(i) );
        m_plugins.insert(std::make_pair(pi.GetName(), pi));
    }
}
开发者ID:05storm26,项目名称:codelite,代码行数:11,代码来源:plugindata.cpp

示例11: OnUpdateCallstack

void NodeJSDebuggerPane::OnUpdateCallstack(clDebugEvent& event)
{
    event.Skip();
    wxWindowUpdateLocker locker(m_dataviewLocals);
    ClearCallstack();

    JSONRoot root(event.GetString());
    JSONElement frames = root.toElement().namedObject("body").namedObject("frames");
    JSONElement refs = root.toElement().namedObject("refs");

    // Load the handlers into a map
    m_handles.clear();
    ParseRefsArray(refs);

    int count = frames.arraySize();
    for(int i = 0; i < count; ++i) {
        JSONElement frame = frames.arrayItem(i);
        int index = frame.namedObject("index").toInt();
        int funcRef = frame.namedObject("func").namedObject("ref").toInt();
        int fileRef = frame.namedObject("script").namedObject("ref").toInt();
        int line = frame.namedObject("line").toInt() + 1;

        wxVector<wxVariant> cols;
        cols.push_back(wxString() << index);
        wxString file, func;
        if(m_handles.count(funcRef)) {
            func = m_handles.find(funcRef)->second.value;
        }
        if(m_handles.count(funcRef)) {
            file = m_handles.find(fileRef)->second.value;
        }
        cols.push_back(func);
        cols.push_back(file);
        cols.push_back(wxString() << line);

        FrameData* cd = new FrameData();
        cd->file = file;
        cd->line = line;
        cd->function = func;
        cd->index = i;
        m_dvListCtrlCallstack->AppendItem(cols, (wxUIntPtr)cd);

        if(i == 0) {
            // Notify the debugger to use frame #0 for the indicator
            clDebugEvent event(wxEVT_NODEJS_DEBUGGER_MARK_LINE);
            event.SetLineNumber(line);
            event.SetFileName(file);
            EventNotifier::Get()->AddPendingEvent(event);
            BuildLocals(frame);
            BuildArguments(frame);
        }
    }
}
开发者ID:huanghjb,项目名称:codelite,代码行数:53,代码来源:NodeJSDebuggerPane.cpp

示例12: FromJSON

void SFTPSettings::FromJSON(const JSONElement& json)
{
    m_accounts.clear();
    m_sshClient = json.namedObject("sshClient").toString(m_sshClient);
    JSONElement arrAccounts = json.namedObject("accounts");
    int size = arrAccounts.arraySize();
    for(int i=0; i<size; ++i) {
        SSHAccountInfo account;
        account.FromJSON(arrAccounts.arrayItem(i));
        m_accounts.push_back( account );
    }
}
开发者ID:292388900,项目名称:codelite,代码行数:12,代码来源:sftp_settings.cpp

示例13: 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();
            m_bindings.insert(std::make_pair(binding.resourceID, binding));
        }
    }
#if 0
    {
        JSONElement globals = root.toElement().namedObject("globals");
        int arrSize = globals.arraySize();
        for(int i = 0; i < arrSize; ++i) {
            JSONElement item = globals.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("actionId").toString();
            m_globalBindings.insert(std::make_pair(binding.resourceID, binding));
        }
    }
#endif
    return *this;
}
开发者ID:05storm26,项目名称:codelite,代码行数:39,代码来源:clKeyboardBindingConfig.cpp

示例14: FromJSON

void DbExplorerSettings::FromJSON(const JSONElement& json)
{
    m_recentFiles = json.namedObject("m_recentFiles").toArrayString();
    m_sqlHistory  = json.namedObject("m_sqlHistory").toArrayString();
    
    // read the connections
    JSONElement arrConnections = json.namedObject("connections");
    for(int i=0; i<arrConnections.arraySize(); ++i) {
        DbConnectionInfo ci;
        ci.FromJSON( arrConnections.arrayItem(i) );
        m_connections.push_back( ci );
    }
}
开发者ID:292388900,项目名称:codelite,代码行数:13,代码来源:db_explorer_settings.cpp

示例15: LoadJSON

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


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