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


C++ reference类代码示例

本文整理汇总了C++中reference的典型用法代码示例。如果您正苦于以下问题:C++ reference类的具体用法?C++ reference怎么用?C++ reference使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: same_date

int same_date(const reference &r1, const reference &r2)
{
  const char *e1;
  const char *s1 = r1.get_date(&e1);
  const char *e2;
  const char *s2 = r2.get_date(&e2);
  if (s1 == 0)
    return s2 == 0;
  else if (s2 == 0)
    return 0;
  else if (e1 - s1 != e2 - s2)
    return 0;
  else
    return memcmp(s1, s2, e1 - s1) == 0;
}
开发者ID:att,项目名称:uwin,代码行数:15,代码来源:ref.cpp

示例2: address

        // Returns the actual address of x even in presence of overloaded
        // operator&
        pointer address(reference x) const noexcept
        {
#if defined(HPX_COMPUTE_DEVICE_CODE)
            return &x;
#else
            return pointer(x.device_ptr(), target_);
#endif
        }
开发者ID:ShmuelLevine,项目名称:hpx,代码行数:10,代码来源:allocator.hpp

示例3: insert

		// R, this->P.
		void insert(reference R)
		{
			R.destroy();

			R.Prev = this->P->Prev;
			R.Next = this->P;

			R.Prev->Next = R.Next->Prev = &R;
		}
开发者ID:BackupTheBerlios,项目名称:cbear-svn,代码行数:10,代码来源:list.hpp

示例4: InsertAnimation

bool GfxAnimationSet::InsertAnimation(const reference<GfxAnimation>& animation)
{
    assert(animation);
    if (animation)
    {
        auto emplaceResult = m_AnimationsMap.emplace(animation->GetAnimationName(), animation);
        return emplaceResult.second;
    }
    return false;
}
开发者ID:codenamecpp,项目名称:RTS2,代码行数:10,代码来源:GfxAnimation.cpp

示例5: same_year

int same_year(const reference &r1, const reference &r2)
{
  const char *ye1;
  const char *ys1 = r1.get_year(&ye1);
  const char *ye2;
  const char *ys2 = r2.get_year(&ye2);
  if (ys1 == 0) {
    if (ys2 == 0)
      return same_date(r1, r2);
    else
      return 0;
  }
  else if (ys2 == 0)
    return 0;
  else if (ye1 - ys1 != ye2 - ys2)
    return 0;
  else
    return memcmp(ys1, ys2, ye1 - ys1) == 0;
}
开发者ID:att,项目名称:uwin,代码行数:19,代码来源:ref.cpp

示例6: dotag

	void dotag()
	{
		last_tag = current;
		std::string name;
		nextword(name);

		int spc = next();
		if (spc == '>')
			unget(spc);
		else if (!isspace(spc))
			throw CoreException("Invalid character in tag name");

		if (name.empty())
			throw CoreException("Empty tag name");

		ConfigItems* items;
		tag = ConfigTag::create(name, current.filename, current.line, items);

		while (kv(items))
		{
			// Do nothing here (silences a GCC warning).
		}

		if (name == mandatory_tag)
		{
			// Found the mandatory tag
			mandatory_tag.clear();
		}

		if (name == "include")
		{
			stack.DoInclude(tag, flags);
		}
		else if (name == "files")
		{
			for(ConfigItems::iterator i = items->begin(); i != items->end(); i++)
			{
				stack.DoReadFile(i->first, i->second, flags, false);
			}
		}
		else if (name == "execfiles")
		{
			for(ConfigItems::iterator i = items->begin(); i != items->end(); i++)
			{
				stack.DoReadFile(i->first, i->second, flags, true);
			}
		}
		else if (name == "define")
		{
			if (flags & FLAG_USE_COMPAT)
				throw CoreException("<define> tags may only be used in XML-style config (add <config format=\"xml\">)");
			std::string varname = tag->getString("name");
			std::string value = tag->getString("value");
			if (varname.empty())
				throw CoreException("Variable definition must include variable name");
			stack.vars[varname] = value;
		}
		else if (name == "config")
		{
			std::string format = tag->getString("format");
			if (format == "xml")
				flags &= ~FLAG_USE_COMPAT;
			else if (format == "compat")
				flags |= FLAG_USE_COMPAT;
			else if (!format.empty())
				throw CoreException("Unknown configuration format " + format);
		}
		else
		{
			stack.output.insert(std::make_pair(name, tag));
		}
		// this is not a leak; reference<> takes care of the delete
		tag = NULL;
	}
开发者ID:KeiroD,项目名称:inspircd,代码行数:74,代码来源:configparser.cpp

示例7: push

inline void push(lua_State*, reference& ref) {
    ref.push();
}
开发者ID:DominikMS,项目名称:sol,代码行数:3,代码来源:stack.hpp

示例8: value_consumer

 value_consumer(reference x)
     : list_(x)
     , pos_(x.begin())
     , end_(x.end())
 {}
开发者ID:peplopez,项目名称:El-Rayo-de-Zeus,代码行数:5,代码来源:values.hpp

示例9: reference

 reference(const reference& o) noexcept {
     L = o.L;
     ref = o.copy();
 }
开发者ID:Dogboss08,项目名称:IntWars,代码行数:4,代码来源:reference.hpp

示例10: RenderString

void StringPrinter::RenderString(const reference<BitmapFont>& bitmapFont, 
    const char* szPrintableString, int maxLength, 
        int positionX, 
        int positionY, 
        int clipWidth, 
        int clipHeight, eUiTextColor color)
{
    assert(bitmapFont);
    if (!bitmapFont || !szPrintableString || maxLength == 0 || clipWidth == 0 || clipHeight == 0)
    {
        return;
    }
    
    // setup palette
    if (mCurrentTextColor != color)
    {
        mCurrentTextColor = color;
        GfxRenderDevice::Instance().SetPaletteEntries(gUiTextColorsRGB[mCurrentTextColor], NUM_UI_TEXT_COLOR_ENTRIES, 0, GFX_PALETTE_UI);
    }

    const BitmapFontDescription& bmpf = bitmapFont->GetFontDescription();

    // tiles buffer
    GfxTile batchQuads[256];

    // process characters
    for (int iquad = 0, currentBoxWidth = 0, currentBoxHeight = 0, ichar = 0;; ++ichar)
    {
        if (szPrintableString[ichar] == 0 || (maxLength > 0 && ichar == maxLength))
        {
            if (iquad > 0)
            {
                mRenderDevice.RenderTilesBatch(bmpf.fontTexture, batchQuads, iquad);
            }
            break;
        }

        const BitmapFontCharacter& bmpc = bitmapFont->GetCharacter(szPrintableString[ichar]);
        if (bmpc.height == 0 || bmpc.width == 0)
        {
            continue;
        }

        bool shouldEnd = 
            ((clipWidth > 0) && (currentBoxWidth + bmpc.width + bmpc.xadvance > clipWidth)) ||
            ((clipHeight > 0) && (currentBoxHeight + bmpc.height > clipHeight));

        if (shouldEnd)
        {
            maxLength = ichar + 1;
            continue;
        }

        currentBoxWidth += bmpc.width + bmpc.xadvance;
        currentBoxHeight += bmpc.height;
        batchQuads[iquad].destination = { positionX, positionY, 128 };
        batchQuads[iquad].rcSource = { bmpc.xoffset, bmpc.yoffset, bmpc.width, bmpc.height };
        batchQuads[iquad].params = {};
        batchQuads[iquad].params.paletteIndex = GFX_PALETTE_UI;
        positionX += bmpc.width + bmpc.xadvance;

        if (++iquad == sizeof(batchQuads))
        {
            mRenderDevice.RenderTilesBatch(bmpf.fontTexture, batchQuads, iquad);
            iquad = 0;
        }
    }    
}
开发者ID:codenamecpp,项目名称:RTS2,代码行数:68,代码来源:StringPrinter.cpp

示例11: setDefaultHandler

 static reference<const WarningHandler> setDefaultHandler(const WarningHandler& handler)
 {
    reference<const WarningHandler> tmp = _defaultHandler;
    _defaultHandler.assign(handler);
    return tmp;
 }
开发者ID:adityapathak89,项目名称:scetlib,代码行数:6,代码来源:warning_impl.hpp

示例12: ModeHandler

	CustomPrefixMode(Module* parent, ConfigTag* Tag)
		: ModeHandler(parent, Tag->getString("name"), 0, PARAM_ALWAYS, MODETYPE_CHANNEL), tag(Tag)
	{
		list = true;
		m_paramtype = TR_NICK;
		std::string v = tag->getString("prefix");
		prefix = v.c_str()[0];
		v = tag->getString("letter");
		mode = v.c_str()[0];
		rank = tag->getInt("rank");
		levelrequired = tag->getInt("ranktoset", rank);
		depriv = tag->getBool("depriv", true);
	}
开发者ID:H7-25,项目名称:inspircd,代码行数:13,代码来源:m_customprefix.cpp

示例13: PrefixMode

	CustomPrefixMode(Module* parent, const std::string& Name, char Letter, char Prefix, ConfigTag* Tag)
		: PrefixMode(parent, Name, Letter, 0, Prefix)
		, tag(Tag)
	{
		unsigned long rank = tag->getUInt("rank", 0, 0, UINT_MAX);
		unsigned long setrank = tag->getUInt("ranktoset", prefixrank, rank, UINT_MAX);
		unsigned long unsetrank = tag->getUInt("ranktounset", setrank, setrank, UINT_MAX);
		bool depriv = tag->getBool("depriv", true);
		this->Update(rank, setrank, unsetrank, depriv);

		ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Created the %s prefix: letter=%c prefix=%c rank=%u ranktoset=%u ranktounset=%i depriv=%d",
			name.c_str(), GetModeChar(), GetPrefix(), GetPrefixRank(), GetLevelRequired(true), GetLevelRequired(false), CanSelfRemove());
	}
开发者ID:Adam-,项目名称:inspircd,代码行数:13,代码来源:m_customprefix.cpp

示例14: InitSession

	void InitSession(StreamSocket* user, bool me_server)
	{
		gnutls_init(&sess, me_server ? GNUTLS_SERVER : GNUTLS_CLIENT);

		profile->SetupSession(sess);
		gnutls_transport_set_ptr(sess, reinterpret_cast<gnutls_transport_ptr_t>(user));
		gnutls_transport_set_push_function(sess, gnutls_push_wrapper);
		gnutls_transport_set_pull_function(sess, gnutls_pull_wrapper);

		if (me_server)
			gnutls_certificate_server_set_request(sess, GNUTLS_CERT_REQUEST); // Request client certificate if any.
	}
开发者ID:NikosPapakonstantinou,项目名称:inspircd,代码行数:12,代码来源:m_ssl_gnutls.cpp

示例15: GetDSN

	std::string GetDSN()
	{
		std::ostringstream conninfo("connect_timeout = '5'");
		std::string item;

		if (conf->readString("host", item))
			conninfo << " host = '" << item << "'";

		if (conf->readString("port", item))
			conninfo << " port = '" << item << "'";

		if (conf->readString("name", item))
			conninfo << " dbname = '" << item << "'";

		if (conf->readString("user", item))
			conninfo << " user = '" << item << "'";

		if (conf->readString("pass", item))
			conninfo << " password = '" << item << "'";

		if (conf->getBool("ssl"))
			conninfo << " sslmode = 'require'";
		else
			conninfo << " sslmode = 'disable'";

		return conninfo.str();
	}
开发者ID:AliSharifi,项目名称:inspircd,代码行数:27,代码来源:m_pgsql.cpp


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