コード例 #1
0
void InvokeContainerApiRequest::WriteTo(TextWriter & w, FormatOptions const &) const
{
    w.Write("ActivateContainerRequest { ");
    w.Write("ApiExecArgs = {0}", apiExecArgs_);
    w.Write("TimeoutTicks = {0}", timeoutTicks_);
    w.Write("}");
}
コード例 #2
0
void TestMultiPackageHostContext::WriteTo(TextWriter & w, FormatOptions const &) const
{
    w.Write("TestMultiPackageHostContext { ");
    w.Write("NodeId = {0}, ", nodeId_);
    w.Write("HostId = {0}, ", hostId_);
    w.Write("}");
}
コード例 #3
0
        void WriteTo(TextWriter& w, FormatOptions const&) const
        {
            // Keep strong references for tracing outside the 
            // lock since these may the last references and when 
            // they release, the OnReleaseReference() callback will 
            // be executed, acquiring the lock again.
            //
            unordered_map<uint64, ComponentRootSPtr> referencesCopy;
            {
                AcquireReadLock lock(lock_);

                for (auto const & reference : references_)
                {
                    auto sptr = reference.second.lock();

                    if (sptr.get() != nullptr)
                    {
                        referencesCopy[reference.first] = sptr;
                    }
                }
            }
                
            w.Write("count={0}\n", referencesCopy.size());

            for (auto const & reference : referencesCopy)
            {
                w.Write(*(reference.second));
            }
        }
コード例 #4
0
void PackageSharingPolicyDescription::WriteTo(TextWriter & w, FormatOptions const &) const
{
    w.Write("PackageSharingPolicyDescription { ");
    w.Write("PackageRef = {0}, ", PackageRef);
    w.Write("Scope = {0},", Scope);
    w.Write("}");
}
コード例 #5
0
QString RewriteBinding::rewrite(QString code, unsigned position,
                                AST::Statement *node)
{
    TextWriter w;
    _writer = &w;
    _position = position;
    _inLoop = 0;

    accept(node);

    unsigned startOfStatement = node->firstSourceLocation().begin() - _position;
    unsigned endOfStatement = node->lastSourceLocation().end() - _position;

    _writer->replace(startOfStatement, 0, QLatin1String("(function ") + QString::fromUtf8(_name) + QLatin1String("() { "));
    _writer->replace(endOfStatement, 0, QLatin1String(" })"));

    if (rewriteDump()) {
        qWarning() << "=============================================================";
        qWarning() << "Rewrote:";
        qWarning() << qPrintable(code);
    }

    w.write(&code);

    if (rewriteDump()) {
        qWarning() << "To:";
        qWarning() << qPrintable(code);
        qWarning() << "=============================================================";
    }

    return code;
}
コード例 #6
0
TEST(TextWriterTest, t2)
{
    std::string outfile(Support::temppath("utm17.txt"));
    std::string infile(Support::datapath("text/utm17_2.txt"));

    FileUtils::deleteFile(outfile);

    TextReader r;
    Options ro;

    ro.add("filename", infile);
    r.setOptions(ro);

    TextWriter w;
    Options wo;

    wo.add("filename", outfile);
    wo.add("order", "X,Y,Z");
    wo.add("quote_header", false);
    wo.add("precision", 2);
    wo.add("delimiter", "  ");
    w.setOptions(wo);
    w.setInput(r);

    PointTable t;

    w.prepare(t);
    w.execute(t);

    EXPECT_EQ(Support::compare_text_files(infile, outfile), true);
}
void RegisterContainerActivatorServiceRequest::WriteTo(TextWriter & w, FormatOptions const &) const
{
    w.Write("RegisterContainerActivatorServiceRequest { ");
    w.Write("ProcessId = {0}", processId_);
    w.Write("ListenAddress = {0}", listenAddress_);
    w.Write("}");
}
コード例 #8
0
ファイル: app.cpp プロジェクト: S-V/Lollipop
void EdApp::SavePersistentData()
{
	// Save layout
	{
		QFile		file(ED_PATH_TO_APP_LAYOUT);
		file.open(QIODevice::WriteOnly);
		if( !file.isOpen() ) {
			mxWarnf("Failed to save layout to file '%s'.\n",ED_PATH_TO_APP_LAYOUT);
			return;
		}

		QDataStream	stream( &file );
		this->SerializeWidgetLayout(stream);
	}

	// Save current settings
	{
		FileWriter	file( ED_PATH_TO_APP_SETTINGS );
		if( file.IsOpen() )
		{
			TextWriter	archive;

			EdSystem::Get().settings.Serialize( archive );

			EdSystem::Get().Event_SerializeAppData( archive );

			archive.WriteAllToStream( file );
		}
	}
}
コード例 #9
0
ファイル: Marks.cpp プロジェクト: galippi/xcsoar
void
Marks::MarkLocation(const GeoPoint &loc,
                    const BrokenDateTime &time,
                    bool play_sound)
{
  Poco::ScopedRWLock protect(lock, true);

  if (play_sound)
    PlayResource(_T("IDR_WAV_CLEAR"));

  marker_store.push_back(loc);

  char message[160];
  sprintf(message, "%02u.%02u.%04u\t%02u:%02u:%02u\tLon:%f\tLat:%f",
          time.day, time.month, time.year,
          time.hour, time.minute, time.second,
          (double)(loc.Longitude.value_degrees()), 
          (double)(loc.Latitude.value_degrees()));

  TextWriter *writer = CreateDataTextFile(_T("xcsoar-marks.txt"), true);
  if (writer != NULL) {
    writer->writeln(message);
    delete writer;
  }
}
コード例 #10
0
void FabricHostOperationReply::WriteTo(TextWriter & w, FormatOptions const &) const
{
    w.Write("FabricHostOperationReply { ");
    w.Write("Error = {0}", error_);
    w.Write("Error message = {0}", errorMessage_);
    w.Write("Data = {0}", data_);
    w.Write("}");
}
コード例 #11
0
void UpdateCodePackageContextRequest::WriteTo(TextWriter & w, FormatOptions const &) const
{
    w.Write("UpdateCodePackageContextRequest { ");
    w.Write("CodeContext = {0}, ", CodeContext);
    w.Write("ActivationId = {0}, ", ActivationId);
    w.Write("Timeout = {0}, ", Timeout);
    w.Write("}");
}
コード例 #12
0
void SecurityAccessPolicyDescription::WriteTo(TextWriter & w, FormatOptions const &) const
{
    w.Write("SecurityAccessPolicyDescription { ");
    w.Write("ResourceRef = {0}, ", ResourceRef);
    w.Write("PrincipalRef = {0}, ", PrincipalRef);
    w.Write("Rights = {0}", Rights);
    w.Write("}");
}
コード例 #13
0
void DeactivateCodePackageRequest::WriteTo(TextWriter & w, FormatOptions const &) const
{
    w.Write("DeactivateCodePackageRequest { ");
    w.Write("CodePackageInstanceId = {0}, ", codePackageInstanceId_);
    w.Write("ActivationId = {0}, ", ActivationId);
    w.Write("Timeout = {0}, ", Timeout);
    w.Write("}");
}
コード例 #14
0
void SharableProxy::RecordVector::WriteTo(TextWriter& w, FormatOptions const&) const
{
    w.Write("{0}\r\n", instance_);

    for (ArbitrationRecord const & record : records_)
    {
        w.Write("{0}:{1}\r\n", record.Monitor, record.ExpireTime);
    }
}
コード例 #15
0
void
WayPointFileWinPilot::composeFlags(TextWriter &writer,
                                   const WaypointFlags &src)
{
  if (src.Airport)
    writer.write('A');
  if (src.TurnPoint)
    writer.write('T');
  if (src.LandPoint)
    writer.write('L');
  if (src.Home)
    writer.write('H');
  if (src.StartPoint)
    writer.write('S');
  if (src.FinishPoint)
    writer.write('F');
  if (src.Restricted)
    writer.write('R');
  if (src.WaypointFlag)
    writer.write('W');

  // set as turnpoint by default if nothing else
  if (!src.Airport && !src.TurnPoint && !src.LandPoint && !src.Home &&
      !src.StartPoint && !src.FinishPoint && !src.Restricted &&
      !src.WaypointFlag)
    writer.write('T');
}
コード例 #16
0
void LogConfigDescription::WriteTo(TextWriter & w, FormatOptions const &) const
{
    w.Write("LogConfigDescription { ");
    w.Write("Driver = {0}, ", Driver);
    w.Write("DriverOpts {");
    for (auto i = 0; i < DriverOpts.size(); i++)
    {
        w.Write("DriverOpt = {0}", DriverOpts[i]);
    }
 
    w.Write("}");
}
コード例 #17
0
ファイル: loggerbuilder.cpp プロジェクト: MrTheodor/gromacs
void LogTargetFormatter::writeEntry(const LogEntry &entry)
{
    if (entry.asParagraph)
    {
        writer_.ensureEmptyLine();
    }
    writer_.writeLine(entry.text);
    if (entry.asParagraph)
    {
        writer_.ensureEmptyLine();
    }
}
コード例 #18
0
		/// <summary>
		/// レコードを書き込みます。
		/// </summary>
		/// <param name="record">
		/// 書き込むデータ
		/// </param>
		/// <returns>
		/// なし
		/// </returns>
		void write(const String& record)
		{
			if (!std::exchange(m_isHead, false))
			{
				m_writer.write(L',');
			}

			m_writer.write(L'\"');

			m_writer.write(record);

			m_writer.write(L'\"');
		}
コード例 #19
0
void DllHostEntryPointDescription::WriteTo(TextWriter & w, FormatOptions const &) const
{
    w.Write("DllHostEntryPointDescription { ");
    w.Write("IsolationPolicyType = {0}, ", IsolationPolicyType);    
    w.Write("Items = {");
    
    for (auto it = begin(HostedDlls); it != end(HostedDlls); ++it)
    {
        w.Write("{0}", *it);
    }

    w.Write("}");
}
コード例 #20
0
ファイル: json.cpp プロジェクト: Adrien81/XCSoar
void
Object::Serialise(TextWriter &writer, int indent) const
{
  writer.Write('{');
  if (indent >= 0)
    writer.NewLine();

  for (auto it = children.begin(), end = children.end(); it != end;) {
    if (indent >= 0) {
      SerialiseIndent(writer, indent + 1);
      writer.Format("\"%s\": ", it->first.c_str());
      it->second->Serialise(writer, indent + 1);
      if (++it != end)
        writer.Write(',');
      writer.NewLine();
    } else {
      writer.Format("\"%s\":", it->first.c_str());
      it->second->Serialise(writer, indent);
      if (++it != end)
        writer.Write(',');
    }
  }

  if (indent >= 0)
    SerialiseIndent(writer, indent);

  writer.Write('}');
}
コード例 #21
0
void
WaypointWriter::WriteWaypoint(TextWriter &writer, const Waypoint& wp)
{
  // Write the waypoint id
  writer.printf("%u,", wp.original_id > 0 ? wp.original_id : wp.id);

  // Write the latitude
  WriteAngle(writer, wp.location.latitude, true);
  writer.write(',');

  // Write the longitude id
  WriteAngle(writer, wp.location.longitude, false);
  writer.write(',');

  // Write the altitude id
  WriteAltitude(writer, wp.altitude);
  writer.write(',');

  // Write the waypoint flags
  WriteFlags(writer, wp);
  writer.write(',');

  // Write the waypoint name
  writer.write(wp.name.c_str());
  writer.write(',');

  // Write the waypoint description
  writer.writeln(wp.comment.c_str());
}
コード例 #22
0
void DllHostHostedDllDescription::WriteTo(TextWriter & w, FormatOptions const &) const
{
    w.Write("DllHostHostedDllDescription { ");
    w.Write("Kind = {0}, ", Kind);
    switch (this->Kind)
    {
    case DllHostHostedDllKind::Unmanaged :
        w.Write(this->Unmanaged);
        break;
    case DllHostHostedDllKind::Managed :
        w.Write(this->Managed);
        break;
    }
    w.Write("}");
}
コード例 #23
0
void
FlarmDetails::SaveSecondary()
{
  TextWriter *writer = CreateDataTextFile(_T("xcsoar-flarm.txt"));
  if (writer == NULL)
    return;

  TCHAR id[16];

  for (unsigned i = 0; i < FLARM_Names.size(); i++)
    writer->printfln(_T("%s=%s"),
                     FLARM_Names[i].ID.format(id),
                     FLARM_Names[i].Name.c_str());

  delete writer;
}
コード例 #24
0
bool MyListView::Export (TextWriter &w)
{
	BListItem* ptr;
	MyItem* item;
	int32 id = 0;
	
	if (w.Err() != brOK) return false;
	while ((ptr = ItemAt(id++)) != NULL) {
		item = (MyItem *)ptr;
		w.WriteString(item->LabelStr());
		w.WriteString("\t");
		w.WriteString(item->ContentStr());
		w.WriteLn();
	}
	return true;
}
コード例 #25
0
ファイル: PolarFileGlue.cpp プロジェクト: CnZoom/XcSoarPull
bool
PolarGlue::SaveToFile(const PolarInfo &polar, TextWriter &writer)
{
  char buffer[256];
  FormatPolar(polar, buffer, 256);
  return writer.WriteLine(buffer);
}
コード例 #26
0
ファイル: GRecord.cpp プロジェクト: kwtskran/XCSoar
void
GRecord::WriteTo(TextWriter &writer) const
{
  char digest[DIGEST_LENGTH + 1];
  GetDigest(digest);

  static constexpr size_t chars_per_line = 16;
  static_assert(DIGEST_LENGTH % chars_per_line == 0, "wrong digest length");

  for (const char *i = digest, *end = digest + DIGEST_LENGTH;
       i != end; i += chars_per_line) {
    writer.Write('G');
    writer.Write(i, chars_per_line);
    writer.NewLine();
  }
}
コード例 #27
0
void X509IdentitySet::WriteTo(TextWriter & w, FormatOptions const &) const
{
    bool outputGenerated = false;
    for (auto const & id : set_)
    {
        if (outputGenerated)
        {
            w.Write(",{0}", id);
        }
        else
        {
            w.Write("{0}", id);
            outputGenerated = true;
        }
    }
}
コード例 #28
0
 void WriteTo(TextWriter& w, FormatOptions const&) const override
 {
     w.Write("[id={0}, utc={1}] stack='{2}'", 
         id_, 
         timestamp_,
         stack_);
 }
コード例 #29
0
ファイル: HiScoreTable.cpp プロジェクト: jason-amju/amju-scp
void SingleHiScoreTable::Draw()
{
  TextWriter* t = Engine::Instance()->GetTextWriter();
  float i = 4.0f;
  for (HiScores::reverse_iterator it = m_hiScores.rbegin(); it != m_hiScores.rend(); ++it)
  {
    std::string s = ToString(it->first);
    int sp = 9 - s.length();
    if (sp > 0)
    {
      s = std::string(sp, ' ') + s;
    }
    t->Print(5, i, s.c_str());
    t->Print(14, i, it->second.c_str());
    i += 1.0f;
  }
}
コード例 #30
0
ファイル: CupWriter.cpp プロジェクト: ThomasXBMC/XCSoar
static void
WriteAngleDMM(TextWriter &writer, const Angle angle, bool is_latitude)
{
  // Calculate degrees, minutes and decimal minutes
  unsigned deg, min, mmm;
  bool is_positive;
  angle.ToDMM(deg, min, mmm, is_positive);

  // Save them into the buffer string
  writer.Format(is_latitude ? "%02u%02u.%03u" : "%03u%02u.%03u",
                deg, min, mmm);

  // Attach the buffer string to the output
  if (is_latitude)
    writer.Write(is_positive ? "N" : "S");
  else
    writer.Write(is_positive ? "E" : "W");
}