Esempio n. 1
0
static void url_encode_array(StringBuffer &ret, CVarRef varr,
                             std::set<void*> &seen_arrs,
                             CStrRef num_prefix, CStrRef key_prefix,
                             CStrRef key_suffix, CStrRef arg_sep) {
  void *id = varr.is(KindOfArray) ?
    (void*)varr.getArrayData() : (void*)varr.getObjectData();
  if (!seen_arrs.insert(id).second) {
    return; // recursive
  }

  Array arr = varr.toArray();

  for (ArrayIter iter(arr); iter; ++iter) {
    Variant data = iter.second();
    if (data.isNull() || data.isResource()) continue;

    String key = iter.first();
    bool numeric = key.isNumeric();

    if (data.is(KindOfArray) || data.is(KindOfObject)) {
      String encoded;
      if (numeric) {
        encoded = key;
      } else {
        encoded = StringUtil::UrlEncode(key);
      }
      StringBuffer new_prefix(key_prefix.size() + num_prefix.size() +
                              encoded.size() + key_suffix.size() + 4);
      new_prefix += key_prefix;
      if (numeric) new_prefix += num_prefix;
      new_prefix += encoded;
      new_prefix += key_suffix;
      new_prefix += "%5B";
      url_encode_array(ret, data, seen_arrs, String(),
                       new_prefix.detach(), String("%5D", AttachLiteral),
                       arg_sep);
    } else {
      if (!ret.empty()) {
        ret += arg_sep;
      }
      ret += key_prefix;
      if (numeric) {
        ret += num_prefix;
        ret += key;
      } else {
        ret += StringUtil::UrlEncode(key);
      }
      ret += key_suffix;
      ret += "=";
      if (data.isInteger() || data.is(KindOfBoolean)) {
        ret += String(data.toInt64());
      } else if (data.is(KindOfDouble)) {
        ret += String(data.toDouble());
      } else {
        ret += StringUtil::UrlEncode(data.toString());
      }
    }
  }
}
Esempio n. 2
0
OOBase::SharedPtr<Indigo::ResourceBundle> Indigo::ZipResource::sub_dir(const char* name) const
{
	OOBase::SharedPtr<ZipResource> ret;
	OOBase::String new_prefix(m_prefix);
	if (!new_prefix.append(name) || !new_prefix.append('/'))
		LOG_ERROR(("Failed to assign string: %s",OOBase::system_error_text()));
	else
	{
		ret = OOBase::allocate_shared<ZipResource>(m_zip,new_prefix);
		if (!ret)
			LOG_ERROR(("Failed to allocate: %s",OOBase::system_error_text()));
	}

	return ret;
}
Esempio n. 3
0
void BidlParser::set_symtab_name(BidlType* bt, const std::string& prefix) {
    if (!bt) {
        return;
    }

    if (prefix.empty()) {
        bt->_symtab_name = "global";
    }
    else {
        if (bt->get_name().find('.') != std::string::npos) {
            bt->_symtab_name = "global." + bt->get_name();
        }
        else {
            bt->_symtab_name = prefix + "." + bt->get_name();
        }
    }

    switch(bt->get_type_id()) {
    case BidlType::SEQUENCE:
        set_symtab_name(
                const_cast<BidlType*>(dynamic_cast<BidlSequence*>(bt)->get_sub_type())
                , prefix);
        break;
    case BidlType::SET:
        set_symtab_name(
                const_cast<BidlType*>(dynamic_cast<BidlSet*>(bt)->get_sub_type())
                , prefix);
        break;
    case BidlType::MAP:
        set_symtab_name(
                const_cast<BidlType*>(dynamic_cast<BidlMap*>(bt)->get_key_type())
                , prefix);
        set_symtab_name(
                const_cast<BidlType*>(dynamic_cast<BidlMap*>(bt)->get_value_type())
                , prefix);
        break;
        break;
    case BidlType::CONST:
        set_symtab_name(
                const_cast<BidlType*>(dynamic_cast<BidlConst*>(bt)->get_field_type())
                , prefix);
        break;
    case BidlType::TYPEDEF:
        set_symtab_name(
                const_cast<BidlType*>(dynamic_cast<BidlTypedef*>(bt)->get_sub_type())
                , prefix);
        break;
    case BidlType::STRUCTFIELD:
        {
            std::string new_prefix(prefix, 0, prefix.find_last_of('.'));
            set_symtab_name(
                    const_cast<BidlType*>(dynamic_cast<BidlStructField*>(bt)->get_field_type())
                    , new_prefix);
        }
        break;
    case BidlType::FUNCTION:
        {
            std::string new_prefix(prefix, 0, prefix.find_last_of('.'));
            set_symtab_name(
                    const_cast<BidlType*>(dynamic_cast<BidlFunction*>(bt)->get_return_type())
                    , new_prefix);
        }
        break;
    case BidlType::FUNCTIONFIELD:
        {
            std::string tmp(prefix, 0, prefix.find_last_of('.'));
            std::string new_prefix(tmp, 0, tmp.find_last_of('.'));
            set_symtab_name(
                    const_cast<BidlType*>(dynamic_cast<BidlFunctionField*>(bt)->get_field_type())
                    , new_prefix);
        }
        break;
    default:
        break;
    }

    std::vector<BidlType*>& children = bt->get_children();
    std::vector<BidlType*>::iterator itr;
    for (itr = children.begin(); itr != children.end(); ++itr) {
        set_symtab_name(*itr, bt->_symtab_name);
    }
}
Esempio n. 4
0
// Load config info
bool ecSettings::LoadConfig()
{
    wxConfig config(wxGetApp().GetSettings().GetConfigAppName());
    
    config.Read(_("/Window Status/FrameStatus"), & m_frameStatus);
    config.Read(_("/Window Status/ShowToolBar"), (bool*) & m_showToolBar);
    config.Read(_("/Window Status/ShowSplashScreen"), (bool*) & m_showSplashScreen);
    config.Read(_("/Window Status/ShowConflictsWindow"), (bool*) & m_showConflictsWindow);
    config.Read(_("/Window Status/ShowPropertiesWindow"), (bool*) & m_showPropertiesWindow);
    config.Read(_("/Window Status/ShowShortDescrWindow"), (bool*) & m_showShortDescrWindow);
    config.Read(_("/Window Status/ShowMemoryWindow"), (bool*) & m_showMemoryWindow);
    config.Read(_("/Window Status/ShowOutputWindow"), (bool*) & m_showOutputWindow);
    
    config.Read(_("/Files/LastFile"), & m_lastFilename);
    
    config.Read(_("/Window Size/WindowX"), & m_frameSize.x);
    config.Read(_("/Window Size/WindowY"), & m_frameSize.y);
    config.Read(_("/Window Size/WindowWidth"), & m_frameSize.width);
    config.Read(_("/Window Size/WindowHeight"), & m_frameSize.height);

    config.Read(_("/Window Size/TreeSashWidth"), & m_treeSashSize.x);
    config.Read(_("/Window Size/TreeSashHeight"), & m_treeSashSize.y);
    config.Read(_("/Window Size/ConfigPaneWidth"), & m_configPaneWidth);
    config.Read(_("/Window Size/ConflictsWidth"), & m_conflictsSashSize.x);
    config.Read(_("/Window Size/ConflictsHeight"), & m_conflictsSashSize.y);
    config.Read(_("/Window Size/PropertiesWidth"), & m_propertiesSashSize.x);
    config.Read(_("/Window Size/PropertiesHeight"), & m_propertiesSashSize.y);
    config.Read(_("/Window Size/ShortDescrWidth"), & m_shortDescrSashSize.x);
    config.Read(_("/Window Size/ShortDescrHeight"), & m_shortDescrSashSize.y);
    config.Read(_("/Window Size/OutputWidth"), & m_outputSashSize.x);
    config.Read(_("/Window Size/OutputHeight"), & m_outputSashSize.y);
    config.Read(_("/Window Size/MemoryWidth"), & m_memorySashSize.x);
    config.Read(_("/Window Size/MemoryHeight"), & m_memorySashSize.y);

    config.Read(_("/Options/ShowMacroNames"), (bool*) & m_showMacroNames);
    config.Read(_("/Options/UseCustomViewer"), (bool*) & m_bUseCustomViewer);
    config.Read(_("/Options/UseExternalBrowser"), (bool*) & m_bUseExternalBrowser);
    
    int tmp = (int) m_eUseCustomBrowser;
    config.Read(_("/Options/UseCustomBrowser"), & tmp);
    m_eUseCustomBrowser = (ecBrowserType) tmp;
    
    config.Read(_("/Options/Browser"), & m_strBrowser);
    config.Read(_("/Options/Viewer"), & m_strViewer);
    config.Read(_("/Options/HexDisplay"), (bool*) & m_bHex);
    config.Read(_("/Options/UseDefaultFonts"), (bool*) & m_windowSettings.m_useDefaults);
    config.Read(_("/Rule/Checking"), & m_nRuleChecking);

    // Find dialog settings
    config.Read(_("/Find/Text"), & m_findText);
    config.Read(_("/Find/MatchWholeWord"), (bool*) & m_findMatchWholeWord);
    config.Read(_("/Find/MatchCase"), & m_findMatchCase);
    config.Read(_("/Find/Direction"), (bool*) & m_findDirection);
    config.Read(_("/Find/SearchWhat"), & m_findSearchWhat);
    config.Read(_("/Find/DialogX"), & m_findDialogPos.x);
    config.Read(_("/Find/DialogY"), & m_findDialogPos.y);

    // Package dialog settings
    config.Read(_("/Packages/OmitHardwarePackages"), & m_omitHardwarePackages);
    config.Read(_("/Packages/MatchPackageNamesExactly"), & m_matchPackageNamesExactly);

    // Run tests settings
    m_runTestsSettings.LoadConfig(config);

    // Fonts
    m_windowSettings.LoadConfig(config);   
    
    if (!config.Read(_("/Paths/UserToolsDir"), & m_userToolsDir))
    {
        // Use the default provided by the installer
        config.Read(_("Default User Tools Path"), & m_userToolsDir);
    }

    // Only to be used if we fail to find the information installed
    // with the Configuration Tool.
    config.Read(_("/Paths/BuildToolsDir"), & m_buildToolsDir);
    if (m_buildToolsDir.IsEmpty()) // first invocation by this user
    {
        // we have no clues as to the location of the build tools so
        // test for ../../../gnutools relative to the configtool location
        wxFileName gnutools = wxFileName (wxGetApp().GetAppDir(), wxEmptyString);
        gnutools.Normalize(); // remove trailing "./" if present
		if (2 < gnutools.GetDirCount())
        {
            gnutools.RemoveDir (gnutools.GetDirCount()-1);
            gnutools.RemoveDir (gnutools.GetDirCount()-1);
            gnutools.RemoveDir (gnutools.GetDirCount()-1);
            gnutools.AppendDir (wxT("gnutools"));
            if (gnutools.DirExists()) // we've found the gnutools
                m_buildToolsDir = gnutools.GetFullPath();
        }
    }

    // look for *objcopy in and under the build tools directory
    if (! m_buildToolsDir.IsEmpty())
    {
        wxArrayString objcopyFiles;
        wxString objcopyFileSpec(wxT("objcopy"));
#ifdef __WXMSW__
        objcopyFileSpec += wxT(".exe");
#endif
        size_t objcopyCount = wxDir::GetAllFiles(m_buildToolsDir, &objcopyFiles, wxT("*") + objcopyFileSpec, wxDIR_FILES | wxDIR_DIRS);
        for (int count=0; count < objcopyCount; count++)
        {
            wxFileName file (objcopyFiles [count]);
            wxString new_prefix (file.GetFullName().Left (file.GetFullName().Find(objcopyFileSpec)));
            if ((! new_prefix.IsEmpty()) && ('-' == new_prefix.Last()))
                new_prefix = new_prefix.Left (new_prefix.Len() - 1); // strip off trailing hyphen
            m_arstrBinDirs.Set(new_prefix, file.GetPath(wxPATH_GET_VOLUME));
        }
    }

    if (!config.Read(_("/Build/Make Options"), & m_strMakeOptions))
    {
#ifdef __WXMSW__
        SYSTEM_INFO SystemInfo;
        GetSystemInfo(&SystemInfo);
//        disable -j option for now due to problem with Cygwin 1.3.18
//        m_strMakeOptions.Printf(_T("-j%d"),SystemInfo.dwNumberOfProcessors);
#endif
    }
    
    // Set default build tools binary directories as specified by the installer
    ecFileName strDefaultBuildToolsPath;

#ifdef __WXMSW__
    {
        // This should look in HKEY_LOCAL_MACHINE

        wxConfig config2(wxT("eCos"), wxEmptyString, wxEmptyString, wxEmptyString, wxCONFIG_USE_GLOBAL_FILE|wxCONFIG_USE_LOCAL_FILE);

        wxString versionKey = GetInstallVersionKey();
        wxConfigPathChanger path(& config2, wxString(wxT("/")) + versionKey + wxT("/"));

        if (!versionKey.IsEmpty() && config2.Read(wxT("Default Build Tools Path"), & strDefaultBuildToolsPath))
        {
#ifdef __WXMSW__
            wxString gccExe(wxT("*-gcc.exe"));
#else
            wxString gccExe(wxT("*-gcc"));
#endif
            
            // Note that this is not a recursive search. Compilers for
            // different targets may be in the same directory. This finds all targets.
            
            // look for *-gcc[.exe] in the default build tools directory
            wxLogNull log;
            wxDir finder(strDefaultBuildToolsPath);
            wxString filename;
            
            if (finder.IsOpened())
            {
                bool bMore = finder.GetFirst(& filename, gccExe);
                while (bMore)
                {
                    wxString targetName = filename.Left(filename.Find(wxT("-gcc")));
                    m_arstrBinDirs.Set(targetName, strDefaultBuildToolsPath);
                    
                    bMore = finder.GetNext(& filename);
                }
            }
        }
    }
#endif

#ifndef __WXMSW__
    // Look in the PATH for build tools, under Unix
    {
        wxString strPath;
        if (wxGetEnv(wxT("PATH"), & strPath))
        {
	    wxString gccExe(wxT("*-gcc"));

	    wxArrayString arstrPath;
            ecUtils::Chop(strPath, arstrPath, wxT(':'));

            for (int i = arstrPath.GetCount()-1;i >= 0; --i)
            { // Reverse order is important to treat path correctly
                if (wxT(".") != arstrPath[i] && !arstrPath[i].IsEmpty())
                {
                    wxLogNull log;
                    wxDir finder(arstrPath[i]);
                    wxString filename;

                    if (finder.IsOpened())
                    {
                        bool bMore = finder.GetFirst(& filename, gccExe);
                        while (bMore)
                        {
                            wxString targetName = filename.Left(filename.Find(wxT("-gcc")));
                            m_arstrBinDirs.Set(targetName, arstrPath[i]);

                            bMore = finder.GetNext(& filename);
                        }
                    }
                }
            }
        }
    }
#endif
    
    // Read build tools directories (current user)
    
    {
        wxConfigPathChanger path(& config, wxT("/Build Tools/"));
        //config.SetPath(wxT("/Build Tools"));
        wxString key(wxT(""));
        long index;
        bool bMore = config.GetFirstEntry(key, index);
        while (bMore)
        {
            wxString value;
            if (config.Read(key, & value))
            {
                m_arstrBinDirs.Set(key, value);
            }
            bMore = config.GetNextEntry(key, index);
        }
    }
    
    // Read toolchain paths (local machine again)
#ifdef __WXMSW__    
    wxArrayString arstrToolChainPaths;

    // Use eCos just as a test.
    //GetRepositoryRegistryClues(arstrToolChainPaths,_T("eCos"));
    GetRepositoryRegistryClues(arstrToolChainPaths,_T("GNUPro eCos"));
    
    size_t i;
    for (i = (size_t) 0; i < arstrToolChainPaths.GetCount(); i++)
    {
        ecFileName strDir(arstrToolChainPaths[i]);
        strDir += wxT("H-i686-cygwin32\\bin");
        
        if (strDir.IsDir())
        {
            // This is a potential toolchain location. Look for *-gcc.exe
            wxLogNull log;
            wxDir finder(strDefaultBuildToolsPath);
            wxString filename;
            
            if (finder.IsOpened())
            {
                bool bMore = finder.GetFirst(& filename, wxT("*-gcc.exe"));
                while (bMore)
                {
                    // TODO: if there is more than one path, we will have to
                    // check the existance of this target name in m_arstrBinDirs and
                    // append to the end, or something.
                    wxString targetName = filename.Left(filename.Find(wxT("-gcc")));
                    m_arstrBinDirs.Set(targetName, strDefaultBuildToolsPath);
                    
                    bMore = finder.GetNext(& filename);
                }
            }
        }
    }

    // The official user tools are now Cygwin 00r1. If you can't find these,
    // try GNUPro unsupported.
    GetRepositoryRegistryClues(m_userToolPaths, wxT("GNUPro 00r1"));
    if (m_userToolPaths.GetCount() == 0)
    {
        GetRepositoryRegistryClues(m_userToolPaths, wxT("Cygwin 00r1"));
    }

    if (m_userToolPaths.GetCount() > 0)
    {
        for ( i = (size_t) 0 ; i < m_userToolPaths.GetCount(); i++)
        {
            ecFileName str(m_userToolPaths[i]);
            str += "H-i686-cygwin32\\bin";
            if(str.IsDir())
            {
                m_userToolPaths[i] = str;
            } else
            {
                m_userToolPaths.Remove(i);
                i--;
            }
        }
    }
    else
    {
        GetRepositoryRegistryClues(m_userToolPaths, wxT("GNUPro unsupported"));
        
        for ( i = (size_t) 0 ; i < m_userToolPaths.GetCount(); i++)
        {
            ecFileName str(m_userToolPaths[i]);
            str += "H-i686-cygwin32\\bin";
            if(str.IsDir())
            {
                m_userToolPaths[i] = str;
            } else
            {
                m_userToolPaths.Remove(i);
                i--;
            }
        }
    }
#endif
    
    // Include the path in the set of potential user paths
    {
        wxString strPath;
        if (wxGetEnv(wxT("PATH"), & strPath))
        {
            wxArrayString arstrPath;
            ecUtils::Chop(strPath, arstrPath, wxT(';'));
            
            for (int i = arstrPath.GetCount()-1;i >= 0; --i)
            { // Reverse order is important to treat path correctly

                const ecFileName &strFolder = arstrPath[i];
                if (wxT(".") != strFolder && !strFolder.IsEmpty())
                {
                    ecFileName strFile(strFolder);
                    strFile += wxT("ls.exe");
                    if ( strFile.Exists() )
                    {
                        if (!wxArrayStringIsMember(m_userToolPaths, strFolder))
                        {
                            m_userToolPaths.Add(strFolder);
                        }

                        if ( m_userToolsDir.IsEmpty() )
                        {
                            m_userToolsDir = strFolder;
                        }
                    }
                }
            }
        }
    }
    
    // Load current repository from eCos Configuration Tool/Paths/RepositoryDir
    {
        wxConfig eCosConfig(wxGetApp().GetSettings().GetConfigAppName(), wxEmptyString, wxEmptyString, wxEmptyString, wxCONFIG_USE_GLOBAL_FILE|wxCONFIG_USE_LOCAL_FILE);
        wxConfigPathChanger path(& config, wxT("/Repository/"));

        //if (!eCosConfig.Read(wxT("Folder"), & m_strRepository))
        if (!eCosConfig.Read(wxT("/Paths/RepositoryDir"), & m_strRepository))
        {
#ifdef __WXMSW__
            // If we can't find the current folder, look for clues in the registry.
            wxArrayString arstr;
            switch (GetRepositoryRegistryClues(arstr, wxT("eCos")))
            {
            case 0:
                break;
            case 1:
            default:
                m_strRepository = arstr[0];
                break;
            }
#elif defined(__WXGTK__)
            // If we can't find the current folder, look for the latest version
            // in /opt/ecos
            m_strRepository = FindLatestVersion();
#else
            // Unsupported platform
            m_strRepositor = wxEmptyString;
#endif
        }

        // If we have set ECOS_REPOSITORY, this overrides whatever we have
        // read or found.
        wxString envVarValue = wxGetenv(wxT("ECOS_REPOSITORY"));
        if (!envVarValue.IsEmpty())
        {
            // Note that ECOS_REPOSITORY has the packages (or ecc) folder in the name.
            // In order to be in the form that is compatible with configtool operation,
            // it needs to have that stripped off.
            envVarValue = ecUtils::PosixToNativePath(envVarValue); // accommodate posix-style ECOS_REPOSITORY value under Cygwin
            wxString packagesName = wxFileNameFromPath(envVarValue);
            if (packagesName == wxT("ecc") || packagesName == wxT("packages"))
                envVarValue = wxPathOnly(envVarValue);

            m_strRepository = envVarValue;
        }
    }

#ifdef __WXMSW__
    if (m_userToolsDir.IsEmpty())
        m_userToolsDir = GetCygwinInstallPath() + wxT("\\bin");
#else
    if (m_userToolsDir.IsEmpty())
        m_userToolsDir = wxT("/bin");
#endif
    
    return TRUE;
}
static void url_encode_array(StringBuffer &ret, const Variant& varr,
                             std::set<void*> &seen_arrs,
                             const String& num_prefix, const String& key_prefix,
                             const String& key_suffix, const String& arg_sep,
                             bool encode_plus = true) {
  void *id = varr.isArray() ?
    (void*)varr.getArrayData() : (void*)varr.getObjectData();
  if (!seen_arrs.insert(id).second) {
    return; // recursive
  }

  // Allow multiple non-recursive references to the same array/object
  SCOPE_EXIT { seen_arrs.erase(id); };

  Array arr;
  if (varr.is(KindOfObject)) {
    Object o = varr.toObject();
    arr = o->isCollection()
      ? varr.toArray()
      : HHVM_FN(get_object_vars(o));
  } else {
    arr = varr.toArray();
  }

  for (ArrayIter iter(arr); iter; ++iter) {
    Variant data = iter.second();
    if (data.isNull() || data.isResource()) continue;

    String key = iter.first();
    bool numeric = key.isNumeric();

    if (data.isArray() || data.is(KindOfObject)) {
      String encoded;
      if (numeric) {
        encoded = key;
      } else {
        encoded = StringUtil::UrlEncode(key, encode_plus);
      }
      StringBuffer new_prefix(key_prefix.size() + num_prefix.size() +
                              encoded.size() + key_suffix.size() + 4);
      new_prefix.append(key_prefix);
      if (numeric) new_prefix.append(num_prefix);
      new_prefix.append(encoded);
      new_prefix.append(key_suffix);
      new_prefix.append("%5B");
      url_encode_array(ret, data, seen_arrs, String(),
                       new_prefix.detach(), String("%5D", CopyString),
                       arg_sep);
    } else {
      if (!ret.empty()) {
        ret.append(arg_sep);
      }
      ret.append(key_prefix);
      if (numeric) {
        ret.append(num_prefix);
        ret.append(key);
      } else {
        ret.append(StringUtil::UrlEncode(key, encode_plus));
      }
      ret.append(key_suffix);
      ret.append("=");
      if (data.isInteger() || data.is(KindOfBoolean)) {
        ret.append(String(data.toInt64()));
      } else if (data.is(KindOfDouble)) {
        ret.append(String(data.toDouble()));
      } else {
        ret.append(StringUtil::UrlEncode(data.toString(), encode_plus));
      }
    }
  }
}
Esempio n. 6
0
static void url_encode_array(StringBuffer &ret, CVarRef varr,
                             std::set<void*> &seen_arrs,
                             const String& num_prefix, const String& key_prefix,
                             const String& key_suffix, const String& arg_sep) {
  void *id = varr.is(KindOfArray) ?
    (void*)varr.getArrayData() : (void*)varr.getObjectData();
  if (!seen_arrs.insert(id).second) {
    return; // recursive
  }

  Array arr;
  if (varr.is(KindOfObject)) {
    Object o = varr.toObject();
    arr = (o.objectForCall()->isCollection()) ?
      varr.toArray() :
      f_get_object_vars(o).toArray();
  } else {
    arr = varr.toArray();
  }

  for (ArrayIter iter(arr); iter; ++iter) {
    Variant data = iter.second();
    if (data.isNull() || data.isResource()) continue;

    String key = iter.first();
    bool numeric = key.isNumeric();

    if (data.is(KindOfArray) || data.is(KindOfObject)) {
      String encoded;
      if (numeric) {
        encoded = key;
      } else {
        encoded = StringUtil::UrlEncode(key);
      }
      StringBuffer new_prefix(key_prefix.size() + num_prefix.size() +
                              encoded.size() + key_suffix.size() + 4);
      new_prefix.append(key_prefix);
      if (numeric) new_prefix.append(num_prefix);
      new_prefix.append(encoded);
      new_prefix.append(key_suffix);
      new_prefix.append("%5B");
      url_encode_array(ret, data, seen_arrs, String(),
                       new_prefix.detach(), String("%5D", CopyString),
                       arg_sep);
    } else {
      if (!ret.empty()) {
        ret.append(arg_sep);
      }
      ret.append(key_prefix);
      if (numeric) {
        ret.append(num_prefix);
        ret.append(key);
      } else {
        ret.append(StringUtil::UrlEncode(key));
      }
      ret.append(key_suffix);
      ret.append("=");
      if (data.isInteger() || data.is(KindOfBoolean)) {
        ret.append(String(data.toInt64()));
      } else if (data.is(KindOfDouble)) {
        ret.append(String(data.toDouble()));
      } else {
        ret.append(StringUtil::UrlEncode(data.toString()));
      }
    }
  }
}