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


C++ String::End方法代码示例

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


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

示例1: LoadConfigFile

//-----------------------------------------------------------------------------------------------------------------------------------------------------
VOID Configuration::LoadConfigFile(LPCTSTR Filename)
{
  TextStream T(File::Open(Filename, FileMode::OPEN));

  while(!T.EndOfStream())
  {
    String L = T.ReadLine();
    if (L.BeginsWith("#"))
      continue;

    String::Iterator i = L.Find('=');
    if (i != L.End())
    {
      String Name = L.Substr(L.Begin(), i);
      String Value = L.Substr(i+1, L.End());

      if (m_Schema.Contains(Name))
      {
        Item I = m_Schema.Get(Name);
        if ((I.m_Source & ConfigurationSource::FILE) == 0)
          continue;
        I.m_Present = TRUE;
      }

      m_ConfigValues.Add(Name,Value);
    }
  }
}
开发者ID:anareboucas,项目名称:nanook,代码行数:29,代码来源:Configuration.cpp

示例2: Contains

bool Contains(const String& text, const String& substr)
{
	for(const char *s = text; s <= text.End() - substr.GetLength(); s++)
		if(strncmp(s, substr, substr.GetLength()) == 0)
			return true;
	return false;
}
开发者ID:ultimatepp,项目名称:mirror,代码行数:7,代码来源:AddressBook.cpp

示例3: EscapeHtml

void EscapeHtml(StringBuffer& out, const String& txt)
{
	const char *s = txt;
	const char *e = txt.End();
	while(s != e) {
		if(*s == 31)
			out.Cat("&nbsp;");
		else
		if(*s == '<')
			out.Cat("&lt;");
		else
		if(*s == '>')
			out.Cat("&gt;");
		else
		if(*s == '&')
			out.Cat("&amp;");
		else
		if(*s == '\"')
			out.Cat("&quot;");
		else
		if((byte)*s < ' ')
			out.Cat(NFormat("&#%d;", (byte)*s));
		else
			out.Cat(*s);
		s++;
	}
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:27,代码来源:Exe.cpp

示例4: SpellWordRaw

bool SpellWordRaw(const WString& wrd, int lang, Vector<String> *withdia)
{
	Speller *f = sGetSpeller(lang);
	if(!f)
		return true;
	if(f->data.GetCount())
		return f->CheckOld(wrd);
	String awrd = ToUpper(ToAscii(wrd).ToString());
	String t1 = ToUtf8(wrd);
	String t2 = ToUtf8(ToLower(wrd));
	for(int i = 0;; i++) {
		if(i + 1 >= f->block.GetCount() || awrd <= f->block[i + 1].first) {
			for(;;) {
				if(i >= f->block.GetCount())
					return f->user.Find(wrd) >= 0;;
				LLOG("Spell block " << i << ": " << f->block[i].first);
				const SpellBlock& b = f->block[i++];
				if(b.first > awrd) {
					LLOG("  --- end");
					return f->user.Find(wrd) >= 0;;
				}
				FileIn in(f->path);
				String ctrl = sZet(in, b.offset, b.ctrl_len);
				String text = sZet(in, b.offset + b.ctrl_len, b.text_len);
				in.Close();
				String w;
				const char *s = ctrl;
				const char *e = ctrl.End();
				const char *t = text;
				const char *te = text.End();
				while(s < e && t < te) {
					w.Trim(*s++);
					while(*t)
						w.Cat(*t++);
					if(w == t1 || w == t2)
						return true;
					if(withdia && t2 == ToLower(ToAscii(w.ToWString()).ToString()))
						withdia->Add(w);
					t++;
				}
			}
		}
	}
	return f->user.Find(wrd) >= 0;;
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:45,代码来源:Speller.cpp

示例5: WriteJSONString

void JSONValue::WriteJSONString(String& dest, const String& str)
{
    dest += '\"';
    
    for (String::ConstIterator it = str.Begin(); it != str.End(); ++it)
    {
        char c = *it;
        
        if (c >= 0x20 && c != '\"' && c != '\\')
            dest += c;
        else
        {
            dest += '\\';
            
            switch (c)
            {
            case '\"':
            case '\\':
                dest += c;
                break;
                
            case '\b':
                dest += 'b';
                break;
                
            case '\f':
                dest += 'f';
                break;
                
            case '\n':
                dest += 'n';
                break;
                
            case '\r':
                dest += 'r';
                break;
                
            case '\t':
                dest += 't';
                break;
                
            default:
                {
                    char buffer[6];
                    sprintf(buffer, "u%04x", c);
                    dest += (const char*)&buffer[0];
                }
                break;
            }
        }
    }
    
    dest += '\"';
}
开发者ID:aoighost,项目名称:tundra-urho3d,代码行数:54,代码来源:JSON.cpp

示例6: RLEToAlpha

Image RLEToAlpha(const String& rle, Size sz)
{
	ImageBuffer ib(sz);
	const byte *s = rle;
	for(int y = 0; y < sz.cy; y++)
		if((const char *)s < rle.End())
			s = UnpackRLE(ib[y], s, sz.cx) + 1;
		else
			memset(ib[y], 0, sz.cx * sizeof(RGBA));
	return ib;
}
开发者ID:dreamsxin,项目名称:ultimatepp,代码行数:11,代码来源:ImlFile.cpp

示例7: ShouldPreserve

bool ShouldPreserve(const String& s)
{
	if(*s == ' ' || *s == '\t' || *s == '\n')
		return true;
	const char *l = s.Last();
	if(*l == ' ' || *l == '\t' || *l == '\n')
		return true;
	l = s.End();
	for(const char *x = s; x < l; x++)
		if(*x == '\t' || *x == '\n' || *x == ' ' && x[1] == ' ')
			return true;
	return false;
}
开发者ID:dreamsxin,项目名称:ultimatepp,代码行数:13,代码来源:XML.cpp

示例8: NormalizePath

String NormalizePath(const char *path, const char *currdir)
{
	String join_path;
	if(!IsFullPath(path))
		path = join_path = AppendFileName(currdir, path);
	String out;
	if(*path && path[1] == ':') {
		out << path[0] << ":\\";
		path += 3;
	}
	else
	if(path[0] == '\\' && path[1] == '\\') {
		out = "\\\\";
		path += 2;
	}
	else
	if(sDirSep(*path)) {
		if(*currdir)
			out << *currdir << ':';
		out.Cat(DIR_SEP);
		path++;
	}
	int outstart = out.GetLength();
	while(*path) {
		if(sDirSep(*path)) {
			while(sDirSep(*path))
				path++;
			if(*path == '\0')
				break;
			if(out.IsEmpty() || *out.Last() != DIR_SEP)
				out.Cat(DIR_SEP);
		}
		const char *b = path;
		while(*path && !sDirSep(*path))
			path++;
		if(path - b == 1 && *b == '.')
			; //no-op
		else if(path - b == 2 && *b == '.' && b[1] == '.') {
			const char *ob = ~out + outstart, *oe = out.End();
			if(oe - 1 > ob && oe[-1] == DIR_SEP)
				oe--;
			while(oe > ob && oe[-1] != DIR_SEP)
				oe--;
			out.Trim((int)(oe - out.Begin()));
		}
		else
			out.Cat(b, (int)(path - b));
	}
	return out;
}
开发者ID:pedia,项目名称:raidget,代码行数:50,代码来源:Path.cpp

示例9: Concat

		String String::Concat(const String& str) const
		{
			String result;

			if (HasChars() || str.HasChars())
			{
				result.Allocate(Length() + str.Length());
				
				Iterator dest = Algo::Range::Copy(Begin(), End(), result.MutableBegin());
				Algo::Range::Copy(str.Begin(), str.End(), dest);
			}

			return result;
		}
开发者ID:odanek,项目名称:saf,代码行数:14,代码来源:String.cpp

示例10: SetOld

bool Speller::SetOld(const String& _data)
{
	data = _data;
	const char *s = data;
	if(s >= data.End()) {
		data.Clear();
		return false;
	}
	charset = *s++;
	s++;// reserved for prefixes
	dict = *s++;
	for(int i = 0; i < 256 - dict; i++) {
		if(s >= data.End()) {
			data.Clear();
			return false;
		}
		voc[i] = s;
		while(*s) s++;
		s++;
	}
	line.Clear();
	while(s < data.End()) {
		if(s + 8 >= data.End()) {
			data.Clear();
			return false;
		}
		int code = Peek32le(s);
		s += 4;
		int len = Peek32le(s);
		s += 4;
		Line& l = line.Add(code);
		l.begin = (const byte *)s;
		s += len;
		l.end = (const byte *)s;
	};
	return true;
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:37,代码来源:Speller.cpp

示例11: Begin

        bool String::operator>(const String& str) const
        {
			ConstIterator iterLeft = Begin(), iterRight = str.Begin();

            while (iterLeft != End() && iterRight != str.End())
            {
                if (*iterLeft != *iterRight)
                {
                    return *iterLeft > *iterRight;
                }
				++iterLeft;
				++iterRight;
            }

            return (Length() > str.Length());
        }
开发者ID:odanek,项目名称:saf,代码行数:16,代码来源:String.cpp

示例12: CreateReference

        void String::CreateReference(const String& str, ConstIterator begin, ConstIterator end)
        {
            if (begin < str.Begin() || end > str.End() || begin >= end)
            {
                throw IllegalArgumentException(SAF_SOURCE_LOCATION, String("Invalid substring bounds."));
            }

            if (str.m_buffer->m_refCounter == Type::NumericLimits<Size>::Max())
            {
                throw OverflowException(SAF_SOURCE_LOCATION, String("Reference counter overflow."));
            }

            m_buffer = str.m_buffer;
			m_begin = m_buffer->m_data + (begin - m_buffer->m_data); // Hack to get rid of const
            m_length = end - begin;
            ++m_buffer->m_refCounter;
        }
开发者ID:odanek,项目名称:saf,代码行数:17,代码来源:String.cpp

示例13: DumpSpecial

static String DumpSpecial(String s)
{
	String out;
	for(const char *p = s.Begin(), *e = s.End(); p < e; p++)
		if((byte)*p >= ' ' && *p != '\xFF')
			out.Cat(*p);
		else {
			switch(*p) {
				case '\a': out.Cat("[\\a]"); break;
				case '\b': out.Cat("[\\b]"); break;
				case '\f': out.Cat("[\\f]"); break;
				case '\v': out.Cat("[\\v]"); break;
				case '\t': out.Cat("[\\t]"); break;
				case '\r': out.Cat("[\\r]"); break;
				case '\n': out.Cat("[\\n]\n"); break;
				default:   out.Cat(NFormat("[\\x%02x", (byte)*p)); break;
			}
		}
	return out;
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:20,代码来源:ProtectClientDemo.cpp

示例14: Recv

void RemoteSlaveProcess::Recv(int part, int timeout)
{
    if(terminated)
        return;
    if(!socket.IsOpen())
    {
        SVRLOG("-> broken pipe");
        terminated = true;
        return;
    }
//	LOG("RemoteSlaveProcess::Recv(" << part << ")");

    int starttick = GetTickCount();
    while( (IsNull(timeout) || int(GetTickCount())-starttick <= timeout) && (socket.Peek() || current_part <= part))
    {
        String data = socket.Read(0);
        SVRLOG("-> [" << current_part << "] = " << data.GetLength() << " bytes: <" << data << ">");
        if(data.IsVoid())
        {
            SVRLOG("-> broken pipe");
            terminated = true;
            return;
        }
        const char *p = data, *e = data.End();
        ASSERT(current_part >= 0 && current_part < __countof(output));
        for(const char *t; e > p && (t = (const char *)memchr(p, 0, e - p));)
        {
            output[current_part].Cat(p, int(t - p));
            p = t + 1;
            if(++current_part >= __countof(output))
            {
                SVRLOG("-> EOF");
                terminated = true;
                return;
            }
        }
        if(p < e)
            output[current_part].Cat(p, int(e - p));
    }
    SVRLOG("-> finished, current_part = " << current_part);
}
开发者ID:kolyden,项目名称:mirror,代码行数:41,代码来源:sproc.cpp

示例15: GetLineMap

Vector<String> GetLineMap(Stream& stream)
{
	Vector<String> out;
	int emp = 0;
	if(stream.IsOpen())
		while(!stream.IsEof()) {
			String s = stream.GetLine();
			const char *p = s, *e = s.End(), *f = e;
			while(e > p && (byte)e[-1] != 9 && (byte)e[-1] < ' ')
				e--;
			if(e == p)
				emp++;
			else
			{
				while(emp-- > 0)
					out.Add(Null);
				if(e != f)
					s.Trim(int(e - p));
				out.Add(s);
				emp = 0;
			}
		}
	return out;
}
开发者ID:ultimatepp,项目名称:mirror,代码行数:24,代码来源:TextDiff.cpp


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