예제 #1
0
파일: http.cpp 프로젝트: Mirocow/balancer
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
파일: Parser.cpp 프로젝트: Advi42/XCSoar
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
파일: Parser.cpp 프로젝트: Advi42/XCSoar
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);
}