本文整理汇总了C++中JSONElement::hasNamedObject方法的典型用法代码示例。如果您正苦于以下问题:C++ JSONElement::hasNamedObject方法的具体用法?C++ JSONElement::hasNamedObject怎么用?C++ JSONElement::hasNamedObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JSONElement
的用法示例。
在下文中一共展示了JSONElement::hasNamedObject方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
}
示例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);
}
}
示例3: ProcessInputBuffer
void NodeJSSocket::ProcessInputBuffer()
{
if(m_firstTimeConnected) {
m_firstTimeConnected = false;
// Apply breakpoints
m_debugger->SetBreakpoints();
// When an uncaught exception is thrown, break
m_debugger->BreakOnException();
m_inBuffer.Clear();
// Let codelite know that we have control
m_debugger->GotControl(true);
} else {
wxString buffer = GetResponse();
while(!buffer.IsEmpty()) {
JSONRoot root(buffer);
JSONElement json = root.toElement();
int reqSeq = json.namedObject("request_seq").toInt();
if(reqSeq != wxNOT_FOUND) {
std::map<size_t, NodeJSHandlerBase::Ptr_t>::iterator iter = m_handlers.find((size_t)reqSeq);
if(iter != m_handlers.end()) {
NodeJSHandlerBase::Ptr_t handler = iter->second;
handler->Process(m_debugger, buffer);
m_handlers.erase(iter);
}
if(json.hasNamedObject("running") && !json.namedObject("running").toBool()) {
wxString responseCommand = json.namedObject("command").toString();
m_debugger->GotControl((m_noBacktraceCommands.count(responseCommand) == 0));
} else {
m_debugger->SetCanInteract(false);
}
} else {
// Notify the debugger that we got control
if((json.namedObject("type").toString() == "event")) {
if(json.namedObject("event").toString() == "break") {
// breakpoint hit, notify we got control + request for backtrace
m_debugger->GotControl(true);
} else if(json.namedObject("event").toString() == "exception") {
JSONElement body = json.namedObject("body");
NodeJSDebuggerException exc;
exc.message = body.namedObject("exception").namedObject("text").toString();;
exc.line = body.namedObject("sourceLine").toInt();
exc.script = body.namedObject("script").namedObject("name").toString();
exc.column = body.namedObject("sourceColumn").toInt();
// the vm execution stopped due to an exception
m_debugger->ExceptionThrown(exc);
}
} else {
m_debugger->SetCanInteract(false);
}
}
// Check to see if we got more reponses in the in-buffer
buffer = GetResponse();
}
}
}
示例4: 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));
}
}
示例5: 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);
}
}
}
示例6: ProcessDefinitionOutput
bool clTernServer::ProcessDefinitionOutput(const wxString& output, clTernDefinition& loc)
{
JSONRoot root(output);
JSONElement json = root.toElement();
if(json.hasNamedObject("file")) {
wxFileName fn(json.namedObject("file").toString());
if(!m_workingDirectory.IsEmpty()) {
fn.MakeAbsolute(m_workingDirectory);
}
loc.file = fn.GetFullPath();
loc.start = json.namedObject("start").toInt();
loc.end = json.namedObject("end").toInt();
return true;
} else if(json.hasNamedObject("url")) {
loc.url = json.namedObject("url").toString();
return true;
}
return false;
}
示例7: ProcessCMakeCompilationDatabase
void CompilationDatabase::ProcessCMakeCompilationDatabase(const wxFileName& compile_commands)
{
JSONRoot root(compile_commands);
JSONElement arr = root.toElement();
try {
wxString sql;
sql = wxT("REPLACE INTO COMPILATION_TABLE (FILE_NAME, FILE_PATH, CWD, COMPILE_FLAGS) VALUES(?, ?, ?, ?)");
wxSQLite3Statement st = m_db->PrepareStatement(sql);
m_db->ExecuteUpdate("BEGIN");
for(int i = 0; i < arr.arraySize(); ++i) {
// Each object has 3 properties:
// directory, command, file
JSONElement element = arr.arrayItem(i);
if(element.hasNamedObject("file") && element.hasNamedObject("directory") &&
element.hasNamedObject("command")) {
wxString cmd = element.namedObject("command").toString();
wxString file = element.namedObject("file").toString();
wxString path = wxFileName(file).GetPath();
wxString cwd = element.namedObject("directory").toString();
cwd = wxFileName(cwd, "").GetPath();
file = wxFileName(file).GetFullPath();
st.Bind(1, file);
st.Bind(2, path);
st.Bind(3, cwd);
st.Bind(4, cmd);
st.ExecuteUpdate();
}
}
m_db->ExecuteUpdate("COMMIT");
} catch(wxSQLite3Exception& e) {
wxUnusedVar(e);
}
}
示例8: FromJSON
void PHPConfigurationData::FromJSON(const JSONElement &json)
{
m_includePaths = json.namedObject("m_includePaths").toArrayString();
m_phpExe = json.namedObject("m_phpExe").toString("php");
m_errorReporting = json.namedObject("m_errorReporting").toString("E_ALL & ~E_NOTICE");
m_xdebugPort = json.namedObject("m_xdebugPort").toInt(9000);
m_xdebugHost = json.namedObject("m_xdebugHost").toString("127.0.0.1");
m_flags = json.namedObject("m_flags").toSize_t(m_flags);
m_xdebugIdeKey = json.namedObject("m_xdebugIdeKey").toString("codeliteide");
m_xdebugIdeKey.Trim().Trim(false);
// xdebug IDE can not be an empty string, or else debugging in command line
// will not work
if(m_xdebugIdeKey.IsEmpty()) {
m_xdebugIdeKey = "codeliteide";
}
bool nodeExists = json.hasNamedObject("m_ccIncludePath");
m_ccIncludePath = json.namedObject("m_ccIncludePath").toArrayString();
if ( !nodeExists && m_ccIncludePath.IsEmpty() ) {
m_ccIncludePath.Add( ::GetCCResourceDirectory() );
}
}