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


C++ StringDataPtr::setValue方法代码示例

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


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

示例1: typeMismatchError

void
FreezeScript::TransformVisitor::visitString(const StringDataPtr& dest)
{
    Slice::TypePtr type = dest->getType();
    if(_info->doDefaultTransform(type))
    {
        StringDataPtr s = StringDataPtr::dynamicCast(_src);
        BooleanDataPtr b = BooleanDataPtr::dynamicCast(_src);
        IntegerDataPtr i = IntegerDataPtr::dynamicCast(_src);
        DoubleDataPtr d = DoubleDataPtr::dynamicCast(_src);
        EnumDataPtr e = EnumDataPtr::dynamicCast(_src);
        ProxyDataPtr p = ProxyDataPtr::dynamicCast(_src);
        if(s || b || i || d || e || p)
        {
            dest->setValue(_src->toString());
        }
        else
        {
            typeMismatchError(type, _src->getType());
        }
    }
    _info->executeCustomTransform(dest, _src);
}
开发者ID:updowndown,项目名称:myffff,代码行数:23,代码来源:TransformVisitor.cpp

示例2:

void
FreezeScript::AssignVisitor::visitString(const StringDataPtr& dest)
{
    dest->setValue(_src->stringValue(_convert));
}
开发者ID:BlackHoleJet,项目名称:freeze,代码行数:5,代码来源:AssignVisitor.cpp

示例3: if

bool
FreezeScript::invokeGlobalFunction(const Ice::CommunicatorPtr& communicator, const string& name, const DataList& args,
                                   DataPtr& result, const DataFactoryPtr& factory, 
                                   const ErrorReporterPtr& errorReporter)
{
    //
    // Global function.
    //
    if(name == "typeOf")
    {
        if(args.size() != 1)
        {
            errorReporter->error("typeOf() requires one argument");
        }
        result = factory->createString(typeToString(args.front()->getType()), false);
        return true;
    }
    else if(name == "generateUUID")
    {
        if(args.size() != 0)
        {
            errorReporter->error("generateUUID() accepts no arguments");
        }
        result = factory->createString(IceUtil::generateUUID(), false);
        return true;
    }
    else if(name == "stringToIdentity")
    {
        StringDataPtr str;
        if(args.size() > 0)
        {
            str = StringDataPtr::dynamicCast(args.front());
        }
        if(args.size() != 1 || !str)
        {
            errorReporter->error("stringToIdentity() requires a string argument");
        }

        //
        // Parse the identity string.
        //
        string idstr = str->stringValue();
        Ice::Identity id;
        try
        {
            id = communicator->stringToIdentity(idstr);
        }
        catch(const Ice::IdentityParseException& ex)
        {
            errorReporter->error("error in stringToIdentity():\n" + ex.str);
        }

        //
        // Create a data representation of Ice::Identity.
        //
        Slice::UnitPtr unit = str->getType()->unit();
        Slice::TypeList l = unit->lookupType("::Ice::Identity", false);
        assert(!l.empty());
        DataPtr identity = factory->create(l.front(), false);
        StringDataPtr member;
        member = StringDataPtr::dynamicCast(identity->getMember("name"));
        assert(member);
        member->setValue(id.name);
        member = StringDataPtr::dynamicCast(identity->getMember("category"));
        assert(member);
        member->setValue(id.category);
        result = identity;
        return true;
    }
    else if(name == "identityToString")
    {
        StructDataPtr identity;
        if(args.size() > 0)
        {
            identity = StructDataPtr::dynamicCast(args.front());
        }
        if(identity)
        {
            Slice::TypePtr argType = identity->getType();
            Slice::StructPtr st = Slice::StructPtr::dynamicCast(argType);
            if(!st || st->scoped() != "::Ice::Identity")
            {
                identity = 0;
            }
        }
        if(args.size() != 1 || !identity)
        {
            errorReporter->error("identityToString() requires a argument of type ::Ice::Identity");
        }

        //
        // Compose the identity.
        //
        Ice::Identity id;
        StringDataPtr member;
        member = StringDataPtr::dynamicCast(identity->getMember("name"));
        assert(member);
        id.name = member->stringValue();
        member = StringDataPtr::dynamicCast(identity->getMember("category"));
        assert(member);
//.........这里部分代码省略.........
开发者ID:bholl,项目名称:zeroc-ice,代码行数:101,代码来源:Functions.cpp


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