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


C++ wxVariant::GetName方法代码示例

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


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

示例1: LogVariant

void LogVariant(const wxString& prefix, const wxVariant& v)
{
    const wxString type = v.GetType();

    wxString info;
    const wxString& name = v.GetName();
    if (type == wxS("arrstring")) {
        wxArrayString as = v.GetArrayString();
        info.Printf(wxS("%svariant type: \"%s\", element count: %zu, name: \"%s\"."),
            prefix, type, as.size(), name);        
        wxLogTrace(wxTRACE_AutoExcel, wxS("%s"), info);
        for (size_t i = 0; i < as.size(); i++) 
        {
            info.Printf(wxS("   string #%zu value: \"%s\""), i, as[i]);
            if ( i == LogVariantMaxItemsInList )
            {
                wxLogTrace(wxTRACE_AutoExcel, wxS("And %zu more strings"), as.size() - i);
                break;
            }
            else            
                wxLogTrace(wxTRACE_AutoExcel, wxS("%s"), info);
        }
        return;
    }
    if (type == wxS("list")) {
        info.Printf(wxS("%sVariant type: \"%s\", element count: %zu, name: \"%s\"."),
            prefix, type, v.GetCount(), name);
        wxLogTrace(wxTRACE_AutoExcel, wxS("%s"), info);
        for (size_t i = 0; i < v.GetCount(); i++)
        {
            if ( i == LogVariantMaxItemsInList )
            {
                wxLogTrace(wxTRACE_AutoExcel, wxS("And %zu more variants"), v.GetCount() - i);
                break;
            } else            
            {
                const wxVariant& vTmp = v[i];
                info.Printf(wxS("   variant #%zu type: \"%s\", value: \"%s\", name: \"%s\"."),
                    i, vTmp.GetType(), vTmp.MakeString(), vTmp.GetName());        
                wxLogTrace(wxTRACE_AutoExcel, wxS("%s"), info);
            }
        }
        return;
    }
    if (type == wxS("void*") && v.GetVoidPtr() != NULL) {
        wxString automationName;
        wxExcelObject object;
        IDispatch* dispatch = (IDispatch*)v.GetVoidPtr();
        dispatch->AddRef();
        object.GetAutomationObject_()->SetDispatchPtr(dispatch);
        info.Printf(wxS("%svariant type: \"IDispatch - %s\", value: \"%s\", name: \"%s\"."),
            prefix, object.GetAutomationObjectName_(false), v.MakeString(), name);    
    } else {
        info.Printf(wxS("%svariant type: \"%s\", value: \"%s\", name: \"%s\"."),
            prefix, type, v.MakeString(), name);        
    }
    wxLogTrace(wxTRACE_AutoExcel, wxS("%s"), info);
}
开发者ID:pbfordev,项目名称:wxAutoExcel,代码行数:58,代码来源:wxAutoExcel_private.cpp

示例2: OnIpcCall

void ApiHandler::OnIpcCall(wxCommandEvent& event) {
	IConnection* conn = (IConnection*)event.GetClientData();
	if (!conn) return;

	const hessian_ipc::Call* call = conn->get_call();
	hessian_ipc::Writer& writer = conn->get_reply_writer();
	if (!call) return;

	const string& m = call->GetMethod();
	const wxString method(m.c_str(), wxConvUTF8, m.size());

	wxLogDebug(wxT("IPC: %s"), method.c_str());

	// Call the function (if it exists)
	bool methodFound = true;
	if (call->IsObjectCall()) {
		const hessian_ipc::Call& call = *conn->get_call();
		const hessian_ipc::Value& v1 = call.GetParameter(0);
		const int editorId = -v1.GetInt();

		EditorCtrl* editor = m_app.GetEditorCtrl(editorId);
		if (!editor) {
			writer.write_fault(hessian_ipc::NoSuchObjectException, "Unknown object");
			conn->reply_done();
			return;
		}

		map<string, PIpcEdFun>::const_iterator p = m_ipcEditorFunctions.find(m.c_str());
		if (p != m_ipcEditorFunctions.end()) {
			try {
				(this->*p->second)(*editor, *conn);
			}
			catch (exception& e) {
				writer.write_fault(hessian_ipc::ServiceException, e.what());
				conn->reply_done();
				return;
			}
		}
		else {
			eMacroCmd cmd(method);
			for (size_t i = 1; i < call.GetParameterCount(); ++i) {
				const hessian_ipc::Value& v = call.GetParameter(i);

				if (v.IsBoolean()) cmd.AddArg(v.GetBoolean());
				else if (v.IsInt()) cmd.AddArg(v.GetInt());
				else if (v.IsString()) {
					const string& arg = v.GetString();
					const wxString argstr(arg.c_str(), wxConvUTF8, arg.size());
					cmd.AddArg(argstr);
				}
				else wxASSERT(false);
			}

			const wxVariant reply = editor->PlayCommand(cmd);
			if (reply.GetName() == wxT("Unknown method")) methodFound = false;
			else editor->ReDraw();

			//TODO: write variant
			writer.write_reply_null();
		}
	}
	else {
		map<string, PIpcFun>::const_iterator p = m_ipcFunctions.find(m.c_str());
		if (p != m_ipcFunctions.end()) {
			try {
				(this->*p->second)(*conn);
			}
			catch (exception& e) {
				writer.write_fault(hessian_ipc::ServiceException, e.what());
				conn->reply_done();
				return;
			}
		}
		else methodFound = false;
	}

	if (!methodFound) {
		writer.write_fault(hessian_ipc::NoSuchMethodException, "Unknown method");
	}

	// Notify connection that it can send the reply (threadsafe)
	conn->reply_done();
}
开发者ID:BBkBlade,项目名称:e,代码行数:83,代码来源:ApiHandler.cpp


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