예제 #1
0
bool AnimateByGID::initWithGids(ValueVector gids, TMXLayer* layer, Vec2 site, float duration)
{
    //ASSERT( gids!=ValueVector::, "AnimateByGID: argument ValueVector must be non-nullptr");

    //float singleDuration = gids->getDuration();
	_layer = layer;
	_site = site;

	float singleDuration = duration * gids.size();

    if (ActionInterval::initWithDuration(singleDuration))
    {
        _nextFrame = 0;
        setGids(gids);
        _origFrame = nullptr;
        _executedLoops = 0;

        _splitTimes->reserve(gids.size());

        float aumUnitsOfTime = 0;
        float newUnitOfTimeValue = singleDuration / gids.size();

        for (auto frame : gids)
        {
            float value = (aumUnitsOfTime * newUnitOfTimeValue) / singleDuration;
            aumUnitsOfTime += 1.0f;
            _splitTimes->push_back(value);
        }    
        return true;
    }
    return false;
}
예제 #2
0
bool UIHeroDetailLayer::loadRepoEquips( eEquipType type, int page_index ) {
    this->setSelectedRepoCell( nullptr );
    if( page_index >= 0 ) {
        int start_index = 6 * page_index;
        ValueVector data = PlayerInfo::getInstance()->getEquipsByRange( (int)type, start_index, 7, 2 );
        
        if( _current_equip_list->getPages().size() <= page_index ) {
            ui::Layout* new_page = ui::Layout::create();
            _current_equip_list->addPage( new_page );
        }
        ui::Layout* page = _current_equip_list->getPages().at( page_index );
        page->removeAllChildren();
        
        if( data.size() > 0 ) {
            int i = 0;
            for( auto itr = data.begin(); itr != data.end(); ++itr ) {
                UIEquipmentCell* cell = UIEquipmentCell::create( itr->asValueMap(), "ui_detail_icon01.png" );
                Point cell_pos = Point::ZERO;
                switch( i ) {
                    case 0:
                        cell_pos = Point( 120, 250 );
                        break;
                    case 1:
                        cell_pos = Point( 315, 250 );
                        break;
                    case 2:
                        cell_pos = Point( 510, 250 );
                        break;
                    case 3:
                        cell_pos = Point( 120, 90 );
                        break;
                    case 4:
                        cell_pos = Point( 315, 90 );
                        break;
                    case 5:
                        cell_pos = Point( 510, 90 );
                        break;
                    default:
                        break;
                }
                cell->setPosition( cell_pos );
                page->addChild( cell );
                if( ++i >= 6 ) {
                    break;
                }
            }
        }
        
        _btn_prev->setVisible( start_index > 0 );
        _btn_next->setVisible( data.size() == 7 );
        
        return true;
    }

    return false;
}
    void swapOrder_(ValueVector& swValues, ValueVector& values) const
    {
        if (swValues.front() > values.back()) {
            for (unsigned origSampleIdx = 0;
                 origSampleIdx < swValues.size() / 2;
                 ++ origSampleIdx)
            {
                unsigned newSampleIdx = swValues.size() - origSampleIdx - 1;

                std::swap(swValues[origSampleIdx], swValues[newSampleIdx]);
                std::swap(values[origSampleIdx], values[newSampleIdx]);
            }
        }
    }
FixtureDef* TiledBodyCreator::createPolygon(ValueMap object)
{
	ValueVector pointsVector = object["points"].asValueVector();
	auto position = Point(object["x"].asFloat() / PTMRATIO, object["y"].asFloat() / PTMRATIO);

	b2PolygonShape *polyshape = new b2PolygonShape();
	b2Vec2 vertices[b2_maxPolygonVertices];
	int vindex = 0;

	if(pointsVector.size() > b2_maxPolygonVertices) {
		CCLOG("Skipping TMX polygon at x=%d,y=%d for exceeding %d vertices", object["x"].asInt(), object["y"].asInt(), b2_maxPolygonVertices);
		return NULL;
	}

	auto fix = new FixtureDef();

	for(Value point : pointsVector) {
		vertices[vindex].x = (point.asValueMap()["x"].asFloat() / PTMRATIO + position.x);
        vertices[vindex].y = (-point.asValueMap()["y"].asFloat() / PTMRATIO + position.y);
		vindex++;
	}

	polyshape->Set(vertices, vindex);
	fix->fixture.shape = polyshape;
    fix->setObjectName(object["name"].asString());

	return fix;
}
예제 #5
0
void DBManager::createBuildingListInfo()
{
    ValueVector data;
    loadCsvData(CSV_BUILDINGLISTINFO, data);
    
    string timeStamp = GM()->getIntToStr(GM()->getTimeStamp());
    string sql = "create table BuildingListInfo(ID integer primary key autoincrement, BuildingID, PositionX, PositionY, BuildState, LastBuildTime, LastGoldHarvest, LastWoodHarvest)";
    executeUpdate(sql);
    
    for (int i = 1; i < data.size(); i++) {
        ValueMap& map = data.at(i).asValueMap();
        sql = "insert into BuildingListInfo values("
        + map["ID"].asString() + ", '"
        + map["BuildingID"].asString() + "', '"
        + map["PositionX"].asString() + "', '"
        + map["PositionY"].asString() + "', '"
        + map["BuildState"].asString() + "', '"
        + timeStamp + "', '"
        + timeStamp + "', '"
        + timeStamp + "')";
        
//        CCLOG("sql: %s", sql.c_str());
        executeUpdate(sql);
    }
}
예제 #6
0
// print the range
void 
htmInterface::printRange( const ValueVector &range) {

#ifdef _WIN32
    char buf[20];
#endif

//using namespace std;
    for(size_t i = 0; i < range.size(); i++) {
	    cout << SpatialIndex::nameById(range[i].lo) << ":"
			 << SpatialIndex::nameById(range[i].hi) << "   ";

// Windows has a bug in the << operator for int64 
// (see MSDN / Knowledge Base / Visual C++ / BUG: Stream Operator << Cannot Handle __int64 Type
#ifdef _WIN32
		sprintf(buf,"%I64d", range[i].lo );
		cout << buf;
		sprintf(buf,"%I64d", range[i].hi );
		cout << buf;
#else
		cout << range[i].lo << " - " << range[i].hi;
#endif
		cout << endl;
	}
}
예제 #7
0
파일: sparse.cpp 프로젝트: thedrakes/libigl
IGL_INLINE void igl::sparse(
  const IndexVector & I,
  const IndexVector & J,
  const ValueVector & V,
  const size_t m,
  const size_t n,
  Eigen::SparseMatrix<T>& X)
{
  using namespace std;
  using namespace Eigen;
  assert((int)I.maxCoeff() < (int)m);
  assert((int)I.minCoeff() >= 0);
  assert((int)J.maxCoeff() < (int)n);
  assert((int)J.minCoeff() >= 0);
  assert(I.size() == J.size());
  assert(J.size() == V.size());
  // Really we just need .size() to be the same, but this is safer
  assert(I.rows() == J.rows());
  assert(J.rows() == V.rows());
  assert(I.cols() == J.cols());
  assert(J.cols() == V.cols());

  vector<Triplet<T> > IJV;
  IJV.reserve(I.size());
  for(int x = 0;x<I.size();x++)
  {
    IJV.push_back(Triplet<T >(I(x),J(x),V(x)));
  }
  X.resize(m,n);
  X.setFromTriplets(IJV.begin(),IJV.end());
}
예제 #8
0
static void printVector(const char *name, ValueVector const &bv) {
  llvm::errs() << name << " : ";
  for (unsigned i = 0; i < bv.size(); ++i) {
    llvm::errs() << ' ' << bv[i];
  }
  llvm::errs() << "\n";
}
예제 #9
0
void DBManager::createPlayerInfo()
{
    ValueVector data;
    loadCsvData(CSV_PLAYERINFO, data);
    
    string sql = "create table PlayerInfo(ID integer primary key autoincrement, Name, Level, Exp, RingCount, GoldCount, WoodCount, GoldCapacity, WoodCapacity)";
    executeUpdate(sql);
    
    for (int i = 1; i < data.size(); i++) {
        ValueMap& map = data.at(i).asValueMap();
        sql = "insert into PlayerInfo values("
        + map["ID"].asString() + ", '"
        + map["Name"].asString() + "', '"
        + map["Level"].asString() + "', '"
        + map["Exp"].asString() + "', '"
        + map["RingCount"].asString() + "', '"
        + map["GoldCount"].asString() + "', '"
        + map["WoodCount"].asString() + "', '"
        + map["GoldCapacity"].asString() + "', '"
        + map["WoodCapacity"].asString() + "')";
        
//        CCLOG("sql: %s", sql.c_str());
        executeUpdate(sql);
    }
}
예제 #10
0
void PrettyPrinter::operator()(const ValueVector& t) const
{
  std::cout << std::endl;
  for (unsigned int i = 0; i != t.size(); ++i) {
    std::cout << getSpace() << "[" << i << "]: ";
    boost::apply_visitor(PrettyPrinter(getIndentation() + 1), t[i]);
  }
}
예제 #11
0
//加载背景音乐
void PreLoad::loadMusic(ValueVector musicFiles){
	for (unsigned int i = 0; i != musicFiles.size(); ++i){
		Value v = musicFiles.at(i);
		SimpleAudioEngine::getInstance()->preloadBackgroundMusic(v.asString().c_str());
		progressUpdate();
	}

}
예제 #12
0
static void printVector(const CFGBlock *block, ValueVector &bv,
                        unsigned num) {
  llvm::errs() << block->getBlockID() << " :";
  for (unsigned i = 0; i < bv.size(); ++i) {
    llvm::errs() << ' ' << bv[i];
  }
  llvm::errs() << " : " << num << '\n';
}
예제 #13
0
//加载声音
void PreLoad::loadEffect(ValueVector effectFiles){
	for (unsigned int i = 0; i != effectFiles.size(); ++i){
		Value v = effectFiles.at(i);
		SimpleAudioEngine::getInstance()->preloadEffect(v.asString().c_str());
		progressUpdate();
	}

}
예제 #14
0
void PreLoad::onEnterTransitionDidFinish(){
	//调用父类的OnEnterTransitionDidFinish方法
	Layer::onEnterTransitionDidFinish();
	//加载preloadResources.plist配置文件,读取文件中的游戏资源名称列表,返回一个ValueMap对象
	ValueMap map = FileUtils::getInstance()->getValueMapFromFile("preloadResources.plist");
	//通过key值取出每种不同类型资源的ValueVector数组
	ValueVector spriteSheets = map.at("SpriteSheets").asValueVector();
	ValueVector effects = map.at("Sounds").asValueVector();
	ValueVector musics = map.at("Musics").asValueVector();
	//多个ValueVector数组的size相加得到需要加载的资源总数量
	_sourceCount = spriteSheets.size() + effects.size() + musics.size();
	//设置进度条更新进度=100 /_sourceCount
	_progressInterval = 100 / _sourceCount;
	//依次加载资源
	loadMusic(musics);
	loadEffect(effects);
	loadSpriteSheets(spriteSheets);

}
예제 #15
0
// check whether an id is in a range
bool htmInterface::inRange( const ValueVector &range, uint64 id) {
    size_t len = range.size() - 1;

	// completely outside range?
	if(id < range[0].lo || id > range[len].hi)return false;

	// check each range
	for(size_t i = 0; i <= len; i++)
		if(id <= range[i].hi && id >= range[i].lo) return true;
	return false;
}
예제 #16
0
void hdf5_index_create(const Input & input_data, OutputIndex & index, ValueVector & vec_value){
    typedef typename std::map<typename Input::value_type, size_t> MapIndexType;
    MapIndexType mapIndex;

    for(size_t i = 0; i < input_data.size(); ++i){
        typename MapIndexType::iterator elem = mapIndex.insert(std::make_pair(input_data[i], vec_value.size())).first;
        index[i] = elem->second;
        if(vec_value.size() == elem->second){
            vec_value.push_back(elem->first);
        }
    }
}
예제 #17
0
void GameMap::createCollisionAreas()
{
	auto ob_group = _tile_map->getObjectGroup("structures_no_image");
	CCASSERT(ob_group, "no object group (structures_no_image)");

	for (auto iter = std::begin(ob_group->getObjects());
	iter != std::end(ob_group->getObjects()); iter++)
	{
		float width = iter->asValueMap()["width"].asFloat();
		float height = iter->asValueMap()["height"].asFloat();
		float x = iter->asValueMap()["x"].asFloat();
		float y = iter->asValueMap()["y"].asFloat()
			- getSizeY() + _tile_map->getTileSize().height;
		std::string type = iter->asValueMap()["type"].asString();

		if (type == "Polygon")
		{
			ValueVector points = iter->asValueMap()["polylinePoints"].asValueVector();
			std::vector<cocos2d::Vec2> poly;

			for (int i = 0; i < points.size(); i++)
			{
				ValueMap a = points[i].asValueMap();

				float xy = a["x"].asFloat();
				float yy = a["y"].asFloat();

				poly.push_back(cocos2d::Vec2(xy + x, y - yy));
			}
			poly.pop_back();

			geometry::Circle min_circle = geometry::enclosingCircleNaive(poly);

			_collision_areas.emplace_back(
				CollisionArea::create(
					_game_world,
					new geometry::Polygon(poly),
					min_circle.origin,
					min_circle.radius));
		}
		else if (type == "Circle")
		{
			float radius = width / 2;
			_collision_areas.emplace_back(
				CollisionArea::create(
					_game_world,
					new geometry::Circle(Vec2(x + width * 0.5f, y + height * 0.5f), radius),
					Vec2(x + width * 0.5f, y + height * 0.5f),
					radius));
		}
	}
}
예제 #18
0
// Transfer metadata from Op to the instructions in CV if it is known
// to be safe to do so.
void Scalarizer::transferMetadata(Instruction *Op, const ValueVector &CV) {
  SmallVector<std::pair<unsigned, MDNode *>, 4> MDs;
  Op->getAllMetadataOtherThanDebugLoc(MDs);
  for (unsigned I = 0, E = CV.size(); I != E; ++I) {
    if (Instruction *New = dyn_cast<Instruction>(CV[I])) {
      for (const auto &MD : MDs)
        if (canTransferMetadata(MD.first))
          New->setMetadata(MD.first, MD.second);
      if (Op->getDebugLoc() && !New->getDebugLoc())
        New->setDebugLoc(Op->getDebugLoc());
    }
  }
}
예제 #19
0
//加载精灵表单
void PreLoad::loadSpriteSheets(ValueVector spriteSheets){
	//该函数会加载与plist文件名称相同但后缀名为png的纹理图片
	//把该plist的所有spriteFrame信息读取出来,在之后的代码中可以通过
	//Sprite::createWithSpriteFrameName(const std::string& spriteFrameName)函数
	//获取对应的精灵帧
	for (unsigned int i = 0; i != spriteSheets.size(); ++i){
		Value v = spriteSheets.at(i);
		SpriteFrameCache::getInstance()->addSpriteFramesWithFile(v.asString().c_str());
		progressUpdate();
	}


}
예제 #20
0
파일: Scalarizer.cpp 프로젝트: gwowen/pocl
// Transfer metadata from Op to the instructions in CV if it is known
// to be safe to do so.
void Scalarizer::transferMetadata(Instruction *Op, const ValueVector &CV) {
  SmallVector<std::pair<unsigned, MDNode *>, 4> MDs;
  Op->getAllMetadataOtherThanDebugLoc(MDs);
  for (unsigned I = 0, E = CV.size(); I != E; ++I) {
    if (Instruction *New = dyn_cast<Instruction>(CV[I])) {
      for (SmallVectorImpl<std::pair<unsigned, MDNode *> >::iterator
             MI = MDs.begin(), ME = MDs.end(); MI != ME; ++MI)
        if (canTransferMetadata(MI->first))
          New->setMetadata(MI->first, MI->second);
      New->setDebugLoc(Op->getDebugLoc());
    }
  }
}
예제 #21
0
string ValueJsonStringVisitor::visit(const ValueVector &v) {
    std::stringstream ret;
    
    ret << "[";
    int i = v.size();
    for (auto& child : v){
        ret << visit(child);
        if (--i)
            ret << ",";
    }
    ret << "]";
    
    return ret.str();
}
예제 #22
0
bool MultiPriceMatch::readFile(const char* fileName,const char* levelID) {

	bool bRet = false;	
	string id = levelID;
	do{
		CC_BREAK_IF(!FileUtils::getInstance()->isFileExist(fileName));

		ValueMap root = FileUtils::getInstance()->getValueMapFromFile(fileName);
		CC_BREAK_IF(root.empty());
		
		ValueVector pl = root["PRODUCT_LIST"].asValueVector();
		CC_BREAK_IF(pl.empty());
		int nSize = pl.size();
		std::vector<int> levelNum_all;
		std::vector<int> levelNum;

		levelNum_all.clear();
		levelNum.clear();

		for(int i = 0; i < nSize; i++){
			levelNum_all.push_back(i);
		}

		std::random_device rd1;
		std::mt19937 g1(rd1());
 		std::shuffle(std::begin(levelNum_all), std::end(levelNum_all), g1);

		for(int n=0; n< _TOTAL_PRODUCTS; ++n){
			levelNum.push_back(levelNum_all[n]);// generate numbers
		}

		for (int i = 0; i < levelNum.size(); i++){
			ValueMap pd = pl[levelNum[i]].asValueMap();
			PRODUCT_INFO p;
			p.id = pd[PD_ID].asString().c_str();
			p.name = pd[PD_NAME].asString().c_str();
			p.image = pd[PD_IMAGE].asString().c_str();
			p.price = pd[PD_PRICE].asString().c_str();
			p.description = pd[PD_DESCRIPTION].asString().c_str();
			p.sku = pd[PD_SKU].asString().c_str();
			_product_list.push_back(p);
		}

	bRet = true;
	}while(0);

	return bRet;
}
/* Your method must have these Node* and Value parameters */
void HelloWorld::gameTestMethod(Node *sender, Value data)
{
    if (!data.isNull() && data.getType() == Value::Type::MAP) {
        ValueMap valueMap = data.asValueMap();
        
        std::string response = valueMap["test_response"].asString();
        CCLOG("Response sent from native: %s", response.c_str());
        
        ValueVector testVector = valueMap["fibonacci"].asValueVector();
        
        size_t vectorSize = testVector.size();
        for (int i = 0; i < vectorSize; i++) {
            CCLOG("Vector value #%d: %d", i, testVector.at(i).asInt());
        }
    }
}
예제 #24
0
CCObject * YHDataManagerImp::loadFile(const std::string & fullpath)
{
    string suffix = pathExtensionWithString(fullpath);
    asciiToLower(suffix);
    
    // 装载对应的对象
    CCObject * obj = NULL;
    if (suffix.compare("plist-array") == 0)
    {
        ValueVector vv = CCFileUtils::getInstance()->getValueVectorFromFile(fullpath);
        CCArray * arr = new CCArray();
        arr->initWithCapacity((ssize_t)vv.size());
        array_Value(arr, vv);
        obj = arr;
    }
    else if (suffix.compare("plist-dictionary") == 0)
    {
        obj = CCDictionary::createWithContentsOfFileThreadSafe(fullpath.c_str());
    }
    else if (suffix.compare("png") == 0 || suffix.compare("jpg") == 0 || suffix.compare("jpeg") == 0
             || suffix.compare("tif") == 0 || suffix.compare("tiff") == 0 || suffix.compare("webp") == 0)
    {
        Image * image = new Image();
        image->initWithImageFile(fullpath);
        obj = image;
    }
    else
    {
        FILE * pFile = fopen(fullpath.c_str(), "r");
        if (pFile != NULL)
        {
            // 获得文件大小
            fseek(pFile, 0, SEEK_END);
            uint32 size = ftell(pFile);
            fseek(pFile, 0, SEEK_SET);
            
            YHByteArray * bytes = new YHByteArray();
            bytes->init(size);
            fread(bytes->getBuffer(), size, 1, pFile);
            obj = bytes;
            
            fclose(pFile);
        }
    }
    
    return obj;
}
예제 #25
0
void DBManager::createMiwuStateInfo()
{
    ValueVector data;
    loadCsvData(CSV_MIWUSTATEINFO, data);
    
    string timeStamp = GM()->getIntToStr(GM()->getTimeStamp());
    string sql = "create table MiwuStateInfo(MiwuID integer primary key autoincrement, Type)";
    executeUpdate(sql);
    
    for (int i = 1; i < data.size(); i++) {
        ValueMap& map = data.at(i).asValueMap();
        sql = "insert into MiwuStateInfo values("
        + map["MiwuID"].asString() + ", '"
        + map["Type"].asString() + "')";
        
//        CCLOG("sql: %s", sql.c_str());
        executeUpdate(sql);
    }
}
예제 #26
0
void DBManager::createSoilderListInfo()
{
    ValueVector data;
    loadCsvData(CSV_SOILDER_LISTINFO, data);
    
    string timeStamp = GM()->getIntToStr(GM()->getTimeStamp());
    string sql = "create table SoilderListInfo(ID integer primary key autoincrement, SoilderID, Count)";
    executeUpdate(sql);
    
    for (int i = 1; i < data.size(); i++) {
        ValueMap& map = data.at(i).asValueMap();
        sql = "insert into SoilderListInfo values("
        + map["ID"].asString() + ", '"
        + map["SoilderID"].asString() + "', '"
        + map["Count"].asString() + "')";
        
//        CCLOG("sql: %s", sql.c_str());
        executeUpdate(sql);
    }
}
예제 #27
0
void GameScene::addHeart(TMXTiledMap *tmx){
    
    ValueVector objects = map->getObjectGroup("heart")->getObjects();
    for (int i = 0; i < objects.size(); i++) {
        
        ValueMap& dict = objects.at(i).asValueMap();
        float x = dict["x"].asFloat();
        float y = dict["y"].asFloat();
        
        Sprite *heart = Sprite::create("heart.png");
        auto physicsBody = PhysicsBody::createCircle(heart->getContentSize().width/2, PhysicsMaterial(0, 0, 1));
        physicsBody->setGravityEnable(false);
        
        heart->setPhysicsBody(physicsBody); //加了物理属性后heart不跟随tmx一起移动
        
        heart->setPosition(Point(x, y));
        
        tmx->addChild(heart);
    }
}
예제 #28
0
파일: sparse.cpp 프로젝트: azer89/BBW
IGL_INLINE void igl::sparse(
  const IndexVector & I,
  const IndexVector & J,
  const ValueVector & V,
  const size_t m,
  const size_t n,
  Eigen::SparseMatrix<T>& X)
{
  using namespace std;
  using namespace Eigen;
  assert((int)I.maxCoeff() < (int)m);
  assert((int)I.minCoeff() >= 0);
  assert((int)J.maxCoeff() < (int)n);
  assert((int)J.minCoeff() >= 0);
  assert(I.size() == J.size());
  assert(J.size() == V.size());
  // Really we just need .size() to be the same, but this is safer
  assert(I.rows() == J.rows());
  assert(J.rows() == V.rows());
  assert(I.cols() == J.cols());
  assert(J.cols() == V.cols());
  //// number of values
  //int nv = V.size();

  //Eigen::DynamicSparseMatrix<T, Eigen::RowMajor> dyn_X(m,n);
  //// over estimate the number of entries
  //dyn_X.reserve(I.size());
  //for(int i = 0;i < nv;i++)
  //{
  //  dyn_X.coeffRef((int)I(i),(int)J(i)) += (T)V(i);
  //}
  //X = Eigen::SparseMatrix<T>(dyn_X);
  vector<Triplet<T> > IJV;
  IJV.reserve(I.size());
  for(int x = 0;x<I.size();x++)
  {
    IJV.push_back(Triplet<T >(I(x),J(x),V(x)));
  }
  X.resize(m,n);
  X.setFromTriplets(IJV.begin(),IJV.end());
}
예제 #29
0
void DBManager::createHeroListInfo()
{
    ValueVector data;
    loadCsvData(CSV_HERO_LISTINFO, data);
    
    string timeStamp = GM()->getIntToStr(GM()->getTimeStamp());
    string sql = "create table HeroListInfo(ID integer primary key autoincrement, HeroID, Exp, State)";
    executeUpdate(sql);
    
    for (int i = 1; i < data.size(); i++) {
        ValueMap& map = data.at(i).asValueMap();
        sql = "insert into HeroListInfo values("
        + map["ID"].asString() + ", '"
        + map["HeroID"].asString() + "', '"
        + map["Exp"].asString() + "', '"
        + map["State"].asString() + "')";
        
//        CCLOG("sql: %s", sql.c_str());
        executeUpdate(sql);
    }
}
예제 #30
0
json_t *NDKHelper::getJsonFromValue(Value value)
{
    if (value.getType() == Value::Type::MAP) {
        ValueMap valueMap = value.asValueMap();

        json_t *jsonDict = json_object();

        for (auto &element : valueMap) {
            json_object_set_new(jsonDict, element.first.c_str(),
                                NDKHelper::getJsonFromValue(element.second));
        }

        return jsonDict;
    } else if (value.getType() == Value::Type::VECTOR) {
        ValueVector valueVector = value.asValueVector();

        json_t *jsonArray = json_array();

        size_t sizeVector = valueVector.size();

        for (unsigned int i = 0; i < sizeVector; i++) {
            json_array_append_new(jsonArray,
                                  NDKHelper::getJsonFromValue(valueVector.at(i)));
        }

        return jsonArray;
    } else if (value.getType() == Value::Type::BOOLEAN) {
        return json_boolean(value.asBool());
    } else if (value.getType() == Value::Type::INTEGER) {
        return json_integer(value.asInt());
    } else if (value.getType() == Value::Type::DOUBLE) {
        return json_real(value.asDouble());
    } else if (value.getType() == Value::Type::STRING) {
        return json_string(value.asString().c_str());
    }

    return NULL;
}