BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
ProjectMessenger.cpp File Reference
#include "G4Svc/ProjectMessenger.h"
#include "G4Svc/Goofy.h"
#include "G4UIcommand.hh"
#include "G4UImanager.hh"
#include "FadsPackageLoader/PackageLoader.h"
#include <fstream.h>
#include <string>

Go to the source code of this file.

Functions

std::string getLine (ifstream &in)
void parseTemplate (std::string dir, std::string filename, std::string dname)

Function Documentation

◆ getLine()

std::string getLine ( ifstream & in)

Definition at line 12 of file ProjectMessenger.cpp.

12 {
13 char buffer[200];
14 if ( in.getline( buffer, 200 ) )
15 {
16 std::string s = buffer;
17 return s;
18 }
19 else return "eof";
20}
XmlRpcServer s

Referenced by parseTemplate().

◆ parseTemplate()

void parseTemplate ( std::string dir,
std::string filename,
std::string dname )

Definition at line 22 of file ProjectMessenger.cpp.

22 {
23 std::string outname = dname;
24 std::string outfile = dir + outname + ".temp";
25 ofstream out( outfile.c_str() );
26 ifstream in( ( dir + filename ).c_str() );
27
28 unsigned int i = 0;
29 std::string buffer;
30 while ( ( buffer = getLine( in ) ) != "eof" )
31 {
32 while ( ( i = buffer.find( "@NAME" ) ) != std::string::npos )
33 {
34 if ( i > 0 ) buffer.replace( i, 5, outname );
35 }
36 out << buffer << std::endl;
37 }
38}
std::string getLine(ifstream &in)
char * c_str(Index i)

Referenced by ProjectMessenger::SetNewValue().