Пример #1
0
TParsedHttpRequest::TParsedHttpRequest(const TStringBuf& str) {
    TStringBuf tmp;

    if (!StripLeft(str).SplitImpl(' ', Method, tmp)) {
        ythrow yexception() << "bad request(" << ToString(str).Quote() << ")";
    }

    if (!StripLeft(tmp).SplitImpl(' ', Request, Proto)) {
        ythrow yexception() << "bad request(" << ToString(str).Quote() << ")";
    }

    Proto = StripLeft(Proto);
}
Пример #2
0
bool
WaypointReaderOzi::VerifyFormat(TLineReader &reader)
{
  const TCHAR *line = reader.ReadLine();
  if (line == nullptr)
    return false;

  return StringStartsWith(StripLeft(line), _T("OziExplorer Waypoint File"));
}
Пример #3
0
void Plane::GenerateIndices(GLuint* indices, unsigned int width, unsigned int height){
	unsigned int i, j;

	//Generate initial index
	i = 0;
	indices[i++] = 0;

	//And the rest
	for (j = 0; j < height; ++j){
		if (j % 2 == 0){
			StripRight(indices, width, j, i);	
		} else {
			StripLeft(indices, width, j, i);
		}
	}
}
Пример #4
0
static const char *
ParseLine(char *line)
{
  char *separator = strchr(line, '=');
  if (separator == nullptr)
    /* malformed line */
    return nullptr;

  char *p = StripRight(line, separator);
  if (p == line)
    /* empty name */
    return nullptr;

  *p = 0;

  char *value = const_cast<char *>(StripLeft(separator + 1));
  StripRight(value);
  return value;
}
Пример #5
0
bool
ParseFileRepository(FileRepository &repository, NLineReader &reader)
{
  AvailableFile file;
  file.Clear();

  char *line;
  while ((line = reader.ReadLine()) != nullptr) {
    line = const_cast<char *>(StripLeft(line));
    if (*line == 0 || *line == '#')
      continue;

    const char *name = line, *value = ParseLine(line);
    if (value == nullptr)
      return false;

    if (StringIsEqual(name, "name")) {
      if (!Commit(repository, file))
        return false;

      file.name.assign(value);
    } else if (file.IsEmpty()) {
      /* ignore */
    } else if (StringIsEqual(name, "uri")) {
      file.uri.assign(value);
    } else if (StringIsEqual(name, "area")) {
      file.area = value;
    } else if (StringIsEqual(name, "type")) {
      if (StringIsEqual(value, "airspace"))
        file.type = FileType::AIRSPACE;
      else if (StringIsEqual(value, "waypoint"))
        file.type = FileType::WAYPOINT;
      else if (StringIsEqual(value, "map"))
        file.type = FileType::MAP;
      else if (StringIsEqual(value, "flarmnet"))
        file.type = FileType::FLARMNET;
    }
  }

  return Commit(repository, file);
}
Пример #6
0
void FString::StripLeft (const FString &charset)
{
	return StripLeft (charset.Chars);
}