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


C++ LLSD::isString方法代码示例

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


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

示例1:

	void SDTestObject::test<14>()
		// make sure that assignment of char* NULL in a string does not crash.
	{
		LLSD v;
		v = (const char*)NULL;
		ensure("type is a string", v.isString());
	}
开发者ID:Krazy-Bish-Margie,项目名称:Thunderstorm,代码行数:7,代码来源:llsd_new_tut.cpp

示例2: setValue

// virtual
// value might be a string or a UUID
void LLIconCtrl::setValue(const LLSD& value )
{
	LLSD tvalue(value);
	if (value.isString() && LLUUID::validate(value.asString()))
	{
		//RN: support UUIDs masquerading as strings
		tvalue = LLSD(LLUUID(value.asString()));
	}
	LLUICtrl::setValue(tvalue);
	if (tvalue.isUUID())
	{
		mImagep = LLUI::getUIImageByID(tvalue.asUUID(), mPriority);
	}
	else
	{
		mImagep = LLUI::getUIImage(tvalue.asString(), mPriority);
	}

	if (mImagep.notNull()
		&& mImagep->getImage().notNull()
		&& mMinWidth
		&& mMinHeight)
	{
		mImagep->getImage()->setKnownDrawSize(llmax(mMinWidth, mImagep->getWidth()), llmax(mMinHeight, mImagep->getHeight()));
	}
}
开发者ID:1234-,项目名称:SingularityViewer,代码行数:28,代码来源:lliconctrl.cpp

示例3: getComparableValue

LLSD LLControlVariable::getComparableValue(const LLSD& value)
{
    // *FIX:MEP - The following is needed to make the LLSD::ImplString
    // work with boolean controls...
    LLSD storable_value;
    if(TYPE_BOOLEAN == type() && value.isString())
    {
        BOOL temp;
        if(LLStringUtil::convertToBOOL(value.asString(), temp))
        {
            storable_value = (bool)temp;
        }
        else
        {
            storable_value = false;
        }
    }
    else if (TYPE_LLSD == type() && value.isString())
    {
        LLPointer<LLSDNotationParser> parser = new LLSDNotationParser;
        LLSD result;
        std::stringstream value_stream(value.asString());
        if (parser->parse(value_stream, result, LLSDSerialize::SIZE_UNLIMITED) != LLSDParser::PARSE_FAILURE)
        {
            storable_value = result;
        }
        else
        {
            storable_value = value;
        }
    }
    else
    {
        storable_value = value;
    }

    return storable_value;
}
开发者ID:,项目名称:,代码行数:38,代码来源:

示例4: selectedListIsFirst

bool LLFloaterAutoReplaceSettings::selectedListIsFirst()
{
	bool isFirst = false;
	
	if (!mSelectedListName.empty())
	{
		LLSD lists = mSettings.getListNames(); // an Array of Strings
		LLSD first = lists.get(0);
		if ( first.isString() && first.asString() == mSelectedListName )
		{
			isFirst = true;
		}
	}
	return isFirst;
}
开发者ID:1234-,项目名称:SingularityViewer,代码行数:15,代码来源:llfloaterautoreplacesettings.cpp

示例5: buildHTTP

// static
LLURI LLURI::buildHTTP(const std::string& prefix,
					   const LLSD& path)
{
	LLURI result;
	
	// TODO: deal with '/' '?' '#' in host_port
	if (prefix.find("://") != prefix.npos)
	{
		// it is a prefix
		result = LLURI(prefix);
	}
	else
	{
		// it is just a host and optional port
		result.mScheme = "http";
		result.mEscapedAuthority = escapeHostAndPort(prefix);
	}

	if (path.isArray())
	{
		// break out and escape each path component
		for (LLSD::array_const_iterator it = path.beginArray();
			 it != path.endArray();
			 ++it)
		{
			lldebugs << "PATH: inserting " << it->asString() << llendl;
			result.mEscapedPath += "/" + escapePathComponent(it->asString());
		}
	}
	else if(path.isString())
	{
		result.mEscapedPath += "/" + escapePathComponent(path.asString());
	} 
	else if(path.isUndefined())
	{
	  // do nothing
	}
    else
	{
	  llwarns << "Valid path arguments to buildHTTP are array, string, or undef, you passed type" 
			  << path.type() << llendl;
	}
	result.mEscapedOpaque = "//" + result.mEscapedAuthority +
		result.mEscapedPath;
	return result;
}
开发者ID:OS-Development,项目名称:VW.Kirsten,代码行数:47,代码来源:lluri.cpp

示例6: setValue

// virtual
// value might be a string or a UUID
void LLIconCtrl::setValue(const LLSD& value )
{
	LLSD tvalue(value);
	if (value.isString() && LLUUID::validate(value.asString()))
	{
		//RN: support UUIDs masquerading as strings
		tvalue = LLSD(LLUUID(value.asString()));
	}
	LLUICtrl::setValue(tvalue);
	if (tvalue.isUUID())
	{
		mImagep = LLUI::getUIImageByID(tvalue.asUUID(), mPriority);
	}
	else
	{
		mImagep = LLUI::getUIImage(tvalue.asString(), mPriority);
	}

	setIconImageDrawSize();
}
开发者ID:AlexRa,项目名称:Kirstens-clone,代码行数:22,代码来源:lliconctrl.cpp

示例7: createServiceDefinition

void LLServiceBuilder::createServiceDefinition(
	const std::string& service_name,
	LLSD& service_llsd)
{
	if(service_llsd.isString())
	{
		mServiceMap[ service_name ] = service_llsd.asString();
	}			
	else if(service_llsd.isMap())
	{
		for(LLSD::map_iterator map_itr = service_llsd.beginMap();
			map_itr != service_llsd.endMap();
			++map_itr)
		{
			std::string compound_builder_name = service_name;
			compound_builder_name.append("-");
			compound_builder_name.append((*map_itr).first);
			mServiceMap[ compound_builder_name ] = (*map_itr).second.asString();
		}
	}
}
开发者ID:BillBarnhill,项目名称:SingularityViewer,代码行数:21,代码来源:llservicebuilder.cpp

示例8: selectedListIsLast

bool LLFloaterAutoReplaceSettings::selectedListIsLast()
{
	bool isLast = false;
	
	if (!mSelectedListName.empty())
	{
		LLSD last;
		LLSD lists = mSettings.getListNames(); // an Array of Strings
		for ( LLSD::array_const_iterator list = lists.beginArray(), listEnd = lists.endArray();
			  list != listEnd;
			  list++
			 )
		{
			last = *list;
		}
		if ( last.isString() && last.asString() == mSelectedListName )
		{
			isLast = true;
		}
	}
	return isLast;
}
开发者ID:1234-,项目名称:SingularityViewer,代码行数:22,代码来源:llfloaterautoreplacesettings.cpp

示例9: getComparableValue

LLSD LLControlVariable::getComparableValue(const LLSD& value)
{
	// *FIX:MEP - The following is needed to make the LLSD::ImplString 
	// work with boolean controls...
	LLSD storable_value;
	if(TYPE_BOOLEAN == type() && value.isString())
	{
		BOOL temp;
		if(LLStringUtil::convertToBOOL(value.asString(), temp)) 
		{
			storable_value = (bool)temp;
		}
		else
		{
			storable_value = false;
		}
	}
	else
	{
		storable_value = value;
	}

	return storable_value;
}
开发者ID:Katharine,项目名称:kittyviewer,代码行数:24,代码来源:llcontrol.cpp

示例10: llsd_matches

// see docstring in .h file
std::string llsd_matches(const LLSD& prototype, const LLSD& data, const std::string& pfx)
{
    // An undefined prototype means that any data is valid.
    // An undefined slot in an array or map prototype means that any data
    // may fill that slot.
    if (prototype.isUndefined())
        return "";
    // A prototype array must match a data array with at least as many
    // entries. Moreover, every prototype entry must match the
    // corresponding data entry.
    if (prototype.isArray())
    {
        if (! data.isArray())
        {
            return STRINGIZE(colon(pfx) << "Array" << op << sTypes.lookup(data.type()));
        }
        if (data.size() < prototype.size())
        {
            return STRINGIZE(colon(pfx) << "Array size " << prototype.size() << op
                             << "Array size " << data.size());
        }
        for (LLSD::Integer i = 0; i < prototype.size(); ++i)
        {
            std::string match(llsd_matches(prototype[i], data[i], STRINGIZE('[' << i << ']')));
            if (! match.empty())
            {
                return match;
            }
        }
        return "";
    }
    // A prototype map must match a data map. Every key in the prototype
    // must have a corresponding key in the data map; every value in the
    // prototype must match the corresponding key's value in the data.
    if (prototype.isMap())
    {
        if (! data.isMap())
        {
            return STRINGIZE(colon(pfx) << "Map" << op << sTypes.lookup(data.type()));
        }
        // If there are a number of keys missing from the data, it would be
        // frustrating to a coder to discover them one at a time, with a big
        // build each time. Enumerate all missing keys.
        std::ostringstream out;
        out << colon(pfx);
        const char* init = "Map missing keys: ";
        const char* sep = init;
        for (LLSD::map_const_iterator mi = prototype.beginMap(); mi != prototype.endMap(); ++mi)
        {
            if (! data.has(mi->first))
            {
                out << sep << mi->first;
                sep = ", ";
            }
        }
        // So... are we missing any keys?
        if (sep != init)
        {
            return out.str();
        }
        // Good, the data block contains all the keys required by the
        // prototype. Now match the prototype entries.
        for (LLSD::map_const_iterator mi2 = prototype.beginMap(); mi2 != prototype.endMap(); ++mi2)
        {
            std::string match(llsd_matches(mi2->second, data[mi2->first],
                                           STRINGIZE("['" << mi2->first << "']")));
            if (! match.empty())
            {
                return match;
            }
        }
        return "";
    }
    // A String prototype can match String, Boolean, Integer, Real, UUID,
    // Date and URI, because any of these can be converted to String.
    if (prototype.isString())
    {
        static LLSD::Type accept[] =
        {
            LLSD::TypeBoolean,
            LLSD::TypeInteger,
            LLSD::TypeReal,
            LLSD::TypeUUID,
            LLSD::TypeDate,
            LLSD::TypeURI
        };
        return match_types(prototype.type(),
                           TypeVector(boost::begin(accept), boost::end(accept)),
                           data.type(),
                           pfx);
    }
    // Boolean, Integer, Real match each other or String. TBD: ensure that
    // a String value is numeric.
    if (prototype.isBoolean() || prototype.isInteger() || prototype.isReal())
    {
        static LLSD::Type all[] =
        {
            LLSD::TypeBoolean,
            LLSD::TypeInteger,
//.........这里部分代码省略.........
开发者ID:NanaYngvarrdottir,项目名称:Virtual-Reality-Viewer-3,代码行数:101,代码来源:llsdutil.cpp

示例11: buildHTTP

// static
LLURI LLURI::buildHTTP(const std::string& prefix,
                       const LLSD& path)
{
    LLURI result;

    // TODO: deal with '/' '?' '#' in host_port
    if (prefix.find("://") != prefix.npos)
    {
        // it is a prefix
        result = LLURI(prefix);
    }
    else
    {
        // it is just a host and optional port
        result.mScheme = "http";
        result.mEscapedAuthority = escapeHostAndPort(prefix);
    }

    if (path.isArray())
    {
        // break out and escape each path component
        for (LLSD::array_const_iterator it = path.beginArray();
                it != path.endArray();
                ++it)
        {
            LL_DEBUGS() << "PATH: inserting " << it->asString() << LL_ENDL;
            result.mEscapedPath += "/" + escapePathComponent(it->asString());
        }
    }
    else if (path.isString())
    {
        std::string pathstr(path);
        // Trailing slash is significant in HTTP land. If caller specified,
        // make a point of preserving.
        std::string last_slash;
        std::string::size_type len(pathstr.length());
        if (len && pathstr[len-1] == '/')
        {
            last_slash = "/";
        }

        // Escape every individual path component, recombining with slashes.
        for (boost::split_iterator<std::string::const_iterator>
                ti(pathstr, boost::first_finder("/")), tend;
                ti != tend; ++ti)
        {
            // Eliminate a leading slash or duplicate slashes anywhere. (Extra
            // slashes show up here as empty components.) This test also
            // eliminates a trailing slash, hence last_slash above.
            if (! ti->empty())
            {
                result.mEscapedPath
                += "/" + escapePathComponent(std::string(ti->begin(), ti->end()));
            }
        }

        // Reinstate trailing slash, if any.
        result.mEscapedPath += last_slash;
    }
    else if(path.isUndefined())
    {
        // do nothing
    }
    else
    {
        LL_WARNS() << "Valid path arguments to buildHTTP are array, string, or undef, you passed type"
                   << path.type() << LL_ENDL;
    }
    result.mEscapedOpaque = "//" + result.mEscapedAuthority +
                            result.mEscapedPath;
    return result;
}
开发者ID:CaseyraeStarfinder,项目名称:Firestorm-Viewer,代码行数:73,代码来源:lluri.cpp


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