本文整理汇总了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);
}
示例2:
void
FreezeScript::AssignVisitor::visitString(const StringDataPtr& dest)
{
dest->setValue(_src->stringValue(_convert));
}
示例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);
//.........这里部分代码省略.........