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


C++ KValueRef::ToList方法代码示例

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


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

示例1: Wrap

	KValueRef ProfiledBoundObject::Wrap(KValueRef value, std::string type)
	{
		if (AlreadyWrapped(value))
		{
			return value;
		}
		else if (value->IsMethod())
		{
			KMethodRef toWrap = value->ToMethod();
			KMethodRef wrapped = new ProfiledBoundMethod(toWrap, type);
			return Value::NewMethod(wrapped);
		}
		else if (value->IsList())
		{
			KListRef wrapped = new ProfiledBoundList(value->ToList());
			return Value::NewList(wrapped);
		}
		else if (value->IsObject())
		{
			KObjectRef wrapped = new ProfiledBoundObject(value->ToObject());
			return Value::NewObject(wrapped);
		}
		else
		{
			return value;
		}
	}
开发者ID:OnlyChristopher,项目名称:TideSDK,代码行数:27,代码来源:profiled_bound_object.cpp

示例2: list

 static std::vector<std::string> ValueToURIList(KValueRef value)
 {
     std::vector<std::string> uriList;
     if (value->IsList())
     {
         KListRef list(value->ToList());
         for (unsigned int i = 0; i < list->Size(); i++)
         {
             KValueRef element(list->At(i));
             if (element->IsString())
                 uriList.push_back(element->ToString());
         }
     }
     else if (value->IsString())
     {
         StringTokenizer tokenizer(value->ToString(), "\n", 
             StringTokenizer::TOK_TRIM | StringTokenizer::TOK_IGNORE_EMPTY);
         for (size_t i = 0; i < tokenizer.count(); i++)
         {
             uriList.push_back(tokenizer[i]);
         }
     }
     else
     {
         throw ValueException::FromString("URI List requires an Array or a newline-delimited String");
     }
     return uriList;
 }
开发者ID:Adimpression,项目名称:TideSDK,代码行数:28,代码来源:clipboard.cpp

示例3: GetList

KListRef KObject::GetList(const char* name, KListRef defaultValue)
{
    KValueRef prop = this->Get(name);
    if (prop->IsList())
    {
        return prop->ToList();
    }
    else
    {
        return defaultValue;
    }
}
开发者ID:toisoftware,项目名称:TideSDK,代码行数:12,代码来源:kobject.cpp

示例4: AddKrollValueToPHPArray

    void KPHPArrayObject::AddKrollValueToPHPArray(KValueRef value, zval *phpArray)
    {
        if (value->IsNull() || value->IsUndefined())
        {
            add_next_index_null(phpArray);
        }
        else if (value->IsBool())
        {
            if (value->ToBool())
                add_next_index_bool(phpArray, 1);
            else
                add_next_index_bool(phpArray, 0);
        }
        else if (value->IsNumber())
        {
            /* No way to check whether the number is an
               integer or a double here. All Kroll numbers
               are doubles, so return a double. This could
               cause some PHP to function incorrectly if it's
               doing strict type checking. */
            add_next_index_double(phpArray, value->ToNumber());
        }
        else if (value->IsString())
        {
            add_next_index_stringl(phpArray, (char *) value->ToString(), strlen(value->ToString()), 1);
        }
        else if (value->IsObject())
        {
            /*TODO: Implement*/
        }
        else if (value->IsMethod())
        {
            /*TODO: Implement*/
        }
        else if (value->IsList())
        {
            zval *phpValue;
            AutoPtr<KPHPArrayObject> pl = value->ToList().cast<KPHPArrayObject>();
            if (!pl.isNull())
                phpValue = pl->ToPHP();
            else
                phpValue = PHPUtils::ToPHPValue(value);

            add_next_index_zval(phpArray, phpValue);
        }
    }
开发者ID:fossamikom,项目名称:TideSDK,代码行数:46,代码来源:k_php_array_object.cpp

示例5: GetStringList

void KObject::GetStringList(const char *name, std::vector<std::string> &list)
{
    KValueRef prop = this->Get(name);
    if(!prop->IsUndefined() && prop->IsList())
    {
        KListRef values = prop->ToList();
        if (values->Size() > 0)
        {
            for (unsigned int c = 0; c < values->Size(); c++)
            {
                KValueRef v = values->At(c);
                if (v->IsString())
                {
                    const char *s = v->ToString();
                    list.push_back(s);
                }
            }
        }
    }
}
开发者ID:toisoftware,项目名称:TideSDK,代码行数:20,代码来源:kobject.cpp

示例6: AlreadyWrapped

	bool ProfiledBoundObject::AlreadyWrapped(KValueRef value)
	{
		if (value->IsMethod()) {
			KMethodRef source = value->ToMethod();
			AutoPtr<ProfiledBoundMethod> po = source.cast<ProfiledBoundMethod>();
			return !po.isNull();

		} else if (value->IsList()) {
			KListRef source = value->ToList();
			AutoPtr<ProfiledBoundList> po = source.cast<ProfiledBoundList>();
			return !po.isNull();

		} else if (value->IsObject()) {
			KObjectRef source = value->ToObject();
			AutoPtr<ProfiledBoundObject> po = source.cast<ProfiledBoundObject>();
			return !po.isNull();

		} else {
			return true;
		}
	}
开发者ID:OnlyChristopher,项目名称:TideSDK,代码行数:21,代码来源:profiled_bound_object.cpp

示例7: GetBytes

 static void GetBytes(KValueRef value, std::vector<BytesRef>& blobs)
 {
     if (value->IsObject())
     {
         blobs.push_back(value->ToObject().cast<Bytes>());
     }
     else if (value->IsString())
     {
         blobs.push_back(new Bytes(value->ToString()));
     }
     else if (value->IsList())
     {
         KListRef list = value->ToList();
         for (size_t j = 0; j < list->Size(); j++)
         {
             GetBytes(list->At((int)j), blobs);
         }
     }
     else if (value->IsNumber())
     {
         blobs.push_back(new Bytes(value->ToInt()));
     }
 }
开发者ID:fossamikom,项目名称:TideSDK,代码行数:23,代码来源:api_binding.cpp

示例8: Execute

void Database::Execute(const ValueList& args, KValueRef result)
{
    args.VerifyException("execute", "s");

    if (!session)
        throw ValueException::FromString("Tried to call execute, but database was closed.");

    std::string sql(args.GetString(0));
    GetLogger()->Debug("Execute called with %s", sql.c_str());
    
    Statement select(*this->session);
    
    try
    {
        ValueBinding binding;
        
        select << sql;
        
        if (args.size()>1)
        {
            
            for (size_t c=1;c<args.size();c++)
            {
                KValueRef anarg = args.at(c);
                if (anarg->IsList())
                {
                    KListRef list = anarg->ToList();
                    for (size_t a=0;a<list->Size();a++)
                    {
                        KValueRef arg = list->At(a);
                        binding.convert(select,arg);
                    }
                }
                else
                {
                    binding.convert(select,anarg);
                }
            }
        }
        Poco::UInt32 count = select.execute();

        GetLogger()->Debug("sql returned: %d rows for result",count);

        this->SetInt("rowsAffected",count);

        // get the row insert id
        Statement ss(*this->session);
        ss << "select last_insert_rowid()", now;
        RecordSet rr(ss);
        Poco::DynamicAny value = rr.value(0);
        int i;
        value.convert(i);
        this->SetInt("lastInsertRowId",i);

        
        if (count > 0)
        {
            RecordSet rs(select);
            KObjectRef r = new ResultSet(rs);
            result->SetObject(r);
        }
        else
        {
            KObjectRef r = new ResultSet();
            result->SetObject(r);
        }
    }
    catch (Poco::Data::DataException &e)
    {
        GetLogger()->Error("Exception executing: %s, Error was: %s", sql.c_str(),
            e.what());
        throw ValueException::FromString(e.what());
    }
}
开发者ID:Defachko,项目名称:titanium_desktop,代码行数:74,代码来源:Database.cpp


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