當前位置: 首頁>>代碼示例>>C++>>正文


C++ Escape函數代碼示例

本文整理匯總了C++中Escape函數的典型用法代碼示例。如果您正苦於以下問題:C++ Escape函數的具體用法?C++ Escape怎麽用?C++ Escape使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了Escape函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: scheme

FUUri::FUUri(const fstring& uri, bool escape)
	:	scheme(FUUri::NONE),
		port(0),
		path(FC(""))
{
	if (uri.empty()) return;

	fstring _uri;

	if (escape)
	{
		_uri = Escape(uri);
	}
	else
	{
		_uri = uri;
	}

	// Replace all '\\' characters by '/' so the path is only using them
	_uri.replace(FC('\\'), FC('/'));

	// Find the scheme from its ':' delimiter
	size_t schemeDelimiterIndex = _uri.find(FC(':'));
	size_t hostIndex = 0;

	if (schemeDelimiterIndex != fstring::npos && schemeDelimiterIndex > 1)
	{
		fstring _scheme = _uri.substr(0, schemeDelimiterIndex);

		if (IsEquivalent(_scheme, FC("FILE")) || IsEquivalent(_scheme, FC("file")))
		{
			scheme = FUUri::FILE;
		}
		else if (IsEquivalent(_scheme, FC("FTP")) || IsEquivalent(_scheme, FC("ftp")))
		{
			scheme = FUUri::FTP;
		}
		else if (IsEquivalent(_scheme, FC("HTTP")) || IsEquivalent(_scheme, FC("http")))
		{
			scheme = FUUri::HTTP;
		}
		else if (IsEquivalent(_scheme, FC("HTTPS")) || IsEquivalent(_scheme, FC("https")))
		{
			scheme = FUUri::HTTPS;
		}
		else
		{
#ifdef WIN32
			// Scheme not supported (could be a NFS path)
			FUFail(return);
#endif // WIN32
		}

		schemeDelimiter = _uri.substr(schemeDelimiterIndex, 3);
		hostIndex = schemeDelimiterIndex + 3;
	}
開發者ID:jb55,項目名稱:jgblue,代碼行數:56,代碼來源:FUUri.cpp

示例2: l_plugin_call

int l_plugin_call(lua_State *L)
{
  char *plugin = (char *) luaL_checkstring(L, 1);
  char *command = (char *) luaL_checkstring(L, 2);
  char *params = (char *) luaL_checkstring(L, 3);

  int escaped_count = Escape(NULL, params, '\\');
  if (escaped_count)
  {
    char *escaped_params = new char[ lstrlen(params) + escaped_count + 1];
    Escape(escaped_params, params, '\\');

    siFuncs->DoCommand(plugin, command, escaped_params);
    delete escaped_params;
  }
  else
    siFuncs->DoCommand(plugin, command, params);

  return 0; // number of return values
}
開發者ID:LosEcher,項目名稱:si_plugins,代碼行數:20,代碼來源:Scripting.cpp

示例3: assert

 // First result as string
 bool CArgMap::Get ( const SString& strCmd, SString& strOut, const char* szDefault ) const
 {
     assert ( szDefault );
     if ( const SString* pResult = MapFind ( m_Map, Escape ( strCmd ) ) )
     {
         strOut = Unescape ( *pResult );
         return true;
     }
     strOut = szDefault;
     return false;
 }
開發者ID:0x688,項目名稱:gtasa_crashfix,代碼行數:12,代碼來源:SharedUtil.Misc.hpp

示例4: ToMathematica

std::string ToMathematica(Quantity<D> const& quantity) {
  std::string s = DebugString(quantity);
  if (IsFinite(quantity)) {
    s.replace(s.find("e"), 1, "*^");
  }
  std::string const number = ToMathematica(quantity / SIUnit<Quantity<D>>());
  std::size_t const split = s.find(" ");
  std::string const units = Escape(s.substr(split, s.size()));
  return Apply(
      "SetPrecision",
      {Apply("Quantity", {number, units}), "MachinePrecision"});
}
開發者ID:mkalte666,項目名稱:Principia,代碼行數:12,代碼來源:mathematica_body.hpp

示例5: Main

void Main()
{
	String code = LoadFile("E:\\sic.sic");
	ArrayMap<String, SVal> global;

	Escape(global, "print(x)", SIC_Print);
	Escape(global, "dump_locals()", SIC_DumpLocals);

	StdLib(global);

	try {
		Scan(global, code);
		TimeStop();
		SVal ret = Execute(global, "main");
		RLOG(TimeStop());
		RLOG("RETURN VALUE: " << ret.Dump());
	}
	catch(CParser::Error& e)
	{
		RLOG(e);
	}
}
開發者ID:dreamsxin,項目名稱:ultimatepp,代碼行數:22,代碼來源:main.cpp

示例6: QString

QByteArray Oauth::HmacSha1(QString secretKey, QString data, QString tokenSecret)
{
    QString signingKey = QString("%1&%2").arg(Escape(secretKey),Escape(tokenSecret));

    unsigned char result[EVP_MAX_MD_SIZE];
    unsigned int resultlen = 0;
    HMAC(
         EVP_sha1(),
         qPrintable(signingKey),
         signingKey.toLocal8Bit().length(),
         (unsigned char*)data.toLocal8Bit().data(),
         data.toLocal8Bit().length(),
         result,
         &resultlen
         );
    char* cbase64 = base64(result,resultlen);
    QByteArray resultArray(cbase64);
    qDebug() << resultArray;
    resultArray = resultArray.toPercentEncoding();
    free(cbase64);
    return resultArray;
}
開發者ID:smandava,項目名稱:cuteflix,代碼行數:22,代碼來源:oauth.cpp

示例7: TPoint

//取得紙張的物理尺寸---單位:點
TPoint __fastcall CPrinter::GetPhicalPaper()
{
    if (PPRN == NULL)
    {
        return TPoint(-1, -1);
    }

    TPoint PageSize;
    //PageSize.X; 紙張物理寬度-單位:點
    //PageSize.Y; 紙張物理高度-單位:點
    Escape(PPRN->Handle, GETPHYSPAGESIZE, 0, NULL, &PageSize);
    return PageSize;
}
開發者ID:vagabond1132,項目名稱:Code,代碼行數:14,代碼來源:uPrinter.cpp

示例8: LayoutOnEscape

static void LayoutOnEscape ()
	{ if (try_and_replace_rule (layout_rule, layout_dir))
	     { XtPopdown (layout_popup);
	       Escape ();
	     }
	  else
	     { StartArgs;
	       SetArg (XtNlabel, tuple_error_buffer);
	       XtSetValues (layout_error, UseArgs);
	       StartArgs;
	       SetArg (XtNeditable, True);
	       XtSetValues (layout_edit, UseArgs);
	     };
	};
開發者ID:tjordanchat,項目名稱:eag,代碼行數:14,代碼來源:edt_editmain.c

示例9: Escape

string MXMLHandler::GetNodeWithTag(const string& xml, string name)
{
	Escape(name);
	string::size_type begin = xml.find("<"+name+">");
	if (begin == string::npos)
		return "";

	string::size_type end = xml.find("</"+name+">", begin);
	if (end == string::npos)
		return "";

	end += name.length() + 3;
	return xml.substr(begin, end - begin);
}
開發者ID:baidang201,項目名稱:sixpieces,代碼行數:14,代碼來源:xmlHandler.cpp

示例10: Escape

void CCSVWriter::WriteRevisions (std::ostream& os, const CCachedLogInfo& cache)
{
	// header

	os << "Revision,AuthorID,TimeStamp,Comment,"
	   << "HasStdInfo,HasChangeInfo,HasMergeInfo,HasUserRevPropInfo\n";

	// content

	const CRevisionIndex& revisions = cache.GetRevisions();
	const CRevisionInfoContainer& logInfo = cache.GetLogInfo();

	for ( revision_t revision = revisions.GetFirstRevision()
		, last = revisions.GetLastRevision()
		; revision < last
		; ++revision)
	{
		index_t index = revisions[revision];
        if (index == NO_INDEX)
            continue;

		std::string comment = logInfo.GetComment (index);
		Escape (comment);

		char presenceFlags = logInfo.GetPresenceFlags (index);
		bool hasStdInfo 
			= (presenceFlags & CRevisionInfoContainer::HAS_STANDARD_INFO) != 0;
		bool hasChangeInfo
			= (presenceFlags & CRevisionInfoContainer::HAS_CHANGEDPATHS) != 0;
		bool hasMergeInfo 
			= (presenceFlags & CRevisionInfoContainer::HAS_MERGEINFO) != 0;
		bool hasRevPropInfo 
			= (presenceFlags & CRevisionInfoContainer::HAS_USERREVPROPS) != 0;

        enum {BUFFER_SIZE = 100};
        char buffer[BUFFER_SIZE];

        __time64_t timestamp = logInfo.GetTimeStamp(index);

		os << revision << ','
		   << logInfo.GetAuthorID(index) << ','
		   << Time64ToZuluString (buffer, timestamp) << ",\""
		   << comment.c_str() << "\","
		   << hasStdInfo << ','
		   << hasChangeInfo << ','
		   << hasMergeInfo << ','
		   << hasRevPropInfo
		   << "\n";
	}
}
開發者ID:fatterbetter,項目名稱:ZTools,代碼行數:50,代碼來源:CSVWriter.cpp

示例11: KG_PROCESS_ERROR

void KAIBase::OnEscape(void)
{
	// 決定是否還要逃跑
	BOOL bRetCode = FALSE;

	KG_PROCESS_ERROR(g_pSO3World->m_nGameLoop < m_EscapeData.nEscapeFrame);

	Escape();
	return;
Exit0:
	// 不跑了,開打
	DoPursuit();
	return;
}
開發者ID:1suming,項目名稱:pap2,代碼行數:14,代碼來源:KAIBase.cpp

示例12: if

LTBOOL CScreenFailure::HandleKeyDown(int key, int rep)
{
	if (key == VK_F9)
	{
		g_pMissionMgr->StartGameFromQuickSave();
		return LTTRUE;
	}
	else if (g_fDuration > g_fMinDelay)
	{
		Escape();
		return LTTRUE;
	}
	return LTFALSE;

}
開發者ID:Arc0re,項目名稱:lithtech,代碼行數:15,代碼來源:ScreenFailure.cpp

示例13: StdLib

void StdLib(ArrayMap<String, SVal>& global)
{
	Escape(global, "is_number(x)", SIC_is_number);
	Escape(global, "is_string(x)", SIC_is_string);

	Escape(global, "def_fn(x, y)", SIC_DefFn);
	Escape(global, "count(x)", SIC_count);
	Escape(global, "get_item(x, i)", SIC_get_item);
	Escape(global, "get_key(x, i)", SIC_get_key);
}
開發者ID:dreamsxin,項目名稱:ultimatepp,代碼行數:10,代碼來源:StdLib.cpp

示例14: Escape

    std::string Args::EscapedArgs(int start, int end) const {
        std::string res;

        if (end < 0) {
            end = args.size() - 1;
        }

        for (int i = start; i < end + 1; i++) {
            if (i != start) {
                res += " ";
            }
            res += Escape(args[i]);
        }

        return res;
    }
開發者ID:Foe-of-Eternity,項目名稱:Unvanquished,代碼行數:16,代碼來源:Command.cpp

示例15: switch

void Game_Battle::UseSkill(Battle::Ally& ally, const RPG::Skill& skill) {

	int sp = ally.GetActor()->CalculateSkillCost(skill.ID);
	if (sp > ally.GetActor()->GetSp()) // not enough SP
		return;

	switch (skill.type) {
		case RPG::Skill::Type_teleport:
			// FIXME: teleport skill
			break;
		case RPG::Skill::Type_escape:
			Escape();
			break;
		case RPG::Skill::Type_switch:
			if (!skill.occasion_battle)
				return;
			Game_Switches[skill.switch_id] = true;
			break;
		case RPG::Skill::Type_normal:
		default:
			switch (skill.scope) {
				case RPG::Skill::Scope_enemy:
					UseSkillEnemy(ally, skill, Game_Battle::GetTargetEnemy());
					return;
				case RPG::Skill::Scope_enemies:
					for (std::vector<Battle::Enemy>::iterator it = Game_Battle::enemies.begin(); it != Game_Battle::enemies.end(); it++)
						UseSkillEnemy(ally, skill, *it);
					break;
				case RPG::Skill::Scope_self:
					UseSkillAlly(ally, skill, ally);
					break;
				case RPG::Skill::Scope_ally:
					UseSkillAlly(ally, skill, Game_Battle::GetTargetAlly());
					return;
				case RPG::Skill::Scope_party:
					for (std::vector<Battle::Ally>::iterator it = Game_Battle::allies.begin(); it != Game_Battle::allies.end(); it++)
						UseSkillAlly(ally, skill, *it);
					break;
			}
			break;
	}

	if (skill.type != RPG::Skill::Type_normal)
		Game_System::SePlay(skill.sound_effect);

	ally.GetActor()->SetSp(ally.GetActor()->GetSp() - sp);
}
開發者ID:ChrisOelmueller,項目名稱:Player,代碼行數:47,代碼來源:battle_algorithms.cpp


注:本文中的Escape函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。