Beispiel #1
0
void
WriteCup(TextWriter &writer, const Waypoints &waypoints,
         WaypointOrigin origin)
{
  // Iterate through the waypoint list and save each waypoint with
  // the right file number to the TextWriter
  /// @todo JMW: iteration ordered by ID would be preferred
  for (auto it = waypoints.begin(); it != waypoints.end(); ++it) {
    const Waypoint& wp = *it;
    if (wp.origin == origin)
      WriteCup(writer, wp);
  }
}
Beispiel #2
0
bool
WaypointGlue::SaveWaypoint(const Waypoint &wp)
{
  const auto path = LocalPath(_T("user.cup"));

  TextWriter writer(path, true);
  if (!writer.IsOpen()) {
    LogFormat(_T("Waypoint file '%s' can not be written"), path.c_str());
    return false;
  }

  WriteCup(writer, wp);
  return true;
}
Beispiel #3
0
bool
WaypointGlue::SaveWaypoints(const Waypoints &way_points)
{
  const auto path = LocalPath(_T("user.cup"));

  TextWriter writer(path);
  if (!writer.IsOpen()) {
    LogFormat(_T("Waypoint file '%s' can not be written"), path.c_str());
    return false;
  }

  WriteCup(writer, way_points, WaypointOrigin::USER);

  LogFormat(_T("Waypoint file '%s' saved"), path.c_str());
  return true;
}