File scpm-no_using_in_header.patch of Package scpm
Index: include/scdb.h
===================================================================
--- include/scdb.h.orig 2012-07-04 17:43:43.310738785 +0200
+++ include/scdb.h 2012-07-04 17:47:25.675388343 +0200
@@ -17,8 +17,6 @@
#ifndef SCDB_H
#define SCDB_H
-using namespace std;
-
#include <vector>
#include <string>
#include <iostream>
@@ -32,21 +30,21 @@ public:
struct dbinfo_t {
- string version;
- string type;
+ std::string version;
+ std::string type;
bool is_local;
};
struct resource_dep_t {
- string name;
- string type;
+ std::string name;
+ std::string type;
};
struct db_action_failed
{
public:
- db_action_failed( string r ) { reason = r; };
- string reason;
+ db_action_failed( std::string r ) { reason = r; };
+ std::string reason;
};
static const int db_state_ok = 0;
@@ -59,123 +57,123 @@ public:
// scdb specific functions
struct dbinfo_t GetDBInfo( );
int LoadDB( ) throw( db_action_failed );
- int LoadDB( string dbfile ) throw( db_action_failed );
- int LoadDB( istream &input, bool quick=false ) throw( db_action_failed );
+ int LoadDB( std::string dbfile ) throw( db_action_failed );
+ int LoadDB( std::istream &input, bool quick=false ) throw( db_action_failed );
void SaveDB( ) throw( db_action_failed );
- void SaveDB( ostream &output ) throw( db_action_failed );
+ void SaveDB( std::ostream &output ) throw( db_action_failed );
void DropDB( );
bool Modified( ) { return modified; };
- string GetSCDBVersion( );
- void SetSCDBVersion( string version );
- string GetFormat( ) { return "xml"; };
- string GetFormatVersion( );
+ std::string GetSCDBVersion( );
+ void SetSCDBVersion( std::string version );
+ std::string GetFormat( ) { return "xml"; };
+ std::string GetFormatVersion( );
bool UpToDate();
// scdb global functions
- void SetStatusFlag( string status_flag, bool value ) throw( db_action_failed );
- bool GetStatusFlag( string status_flag ) throw( db_action_failed );
- void SetStatusKey( string status_key, string value ) throw( db_action_failed );
- string GetStatusKey( string status_key ) throw( db_action_failed );
- void SetActiveProfile( string profile_name ) throw( db_action_failed );
- string GetActiveProfile( ) throw( db_action_failed );
- vector<string> GetProfiles( ) throw( db_action_failed );
+ void SetStatusFlag( std::string status_flag, bool value ) throw( db_action_failed );
+ bool GetStatusFlag( std::string status_flag ) throw( db_action_failed );
+ void SetStatusKey( std::string status_key, std::string value ) throw( db_action_failed );
+ std::string GetStatusKey( std::string status_key ) throw( db_action_failed );
+ void SetActiveProfile( std::string profile_name ) throw( db_action_failed );
+ std::string GetActiveProfile( ) throw( db_action_failed );
+ std::vector<std::string> GetProfiles( ) throw( db_action_failed );
// resource functions
- bool ResourceExists( string resource_name, string resource_type )
+ bool ResourceExists( std::string resource_name, std::string resource_type )
throw( db_action_failed );
- void ResourceAdd( string resource_name, string resource_type )
+ void ResourceAdd( std::string resource_name, std::string resource_type )
throw( db_action_failed );
- void ResourceAddType( string resource_type )
+ void ResourceAddType( std::string resource_type )
throw( db_action_failed );
- void ResourceDelete( string resource_name, string resource_type )
+ void ResourceDelete( std::string resource_name, std::string resource_type )
throw( db_action_failed );
- void ResourceAddDep( string resource_name, string resource_type, string dep_name, string dep_type )
+ void ResourceAddDep( std::string resource_name, std::string resource_type, std::string dep_name, std::string dep_type )
throw( db_action_failed );
- void ResourceCleanDeps( string resource_name, string resource_type )
+ void ResourceCleanDeps( std::string resource_name, std::string resource_type )
throw( db_action_failed );
- vector<resource_dep_t> ResourceGetDeps( string resource_name, string resource_type )
+ std::vector<resource_dep_t> ResourceGetDeps( std::string resource_name, std::string resource_type )
throw( db_action_failed );
- vector<string> ResourceGetTypes( )
+ std::vector<std::string> ResourceGetTypes( )
throw( db_action_failed );
- vector<string> ResourceGetNames( string resource_type )
+ std::vector<std::string> ResourceGetNames( std::string resource_type )
throw( db_action_failed );
- void ResourceAddData( string resource_name, string resource_type,
- string data_entry, string data_value )
+ void ResourceAddData( std::string resource_name, std::string resource_type,
+ std::string data_entry, std::string data_value )
throw( db_action_failed );
- void ResourceClearData( string resource_name, string resource_type )
+ void ResourceClearData( std::string resource_name, std::string resource_type )
throw( db_action_failed );
- void ResourceGetData( string resource_name, string resource_type,
- vector<string> &data_entries, vector<string> &data_values )
+ void ResourceGetData( std::string resource_name, std::string resource_type,
+ std::vector<std::string> &data_entries, std::vector<std::string> &data_values )
throw( db_action_failed );
// profile functions
- bool ProfileExists( string profile_name )
+ bool ProfileExists( std::string profile_name )
throw( db_action_failed );
- void ProfileAdd( string profile_name )
+ void ProfileAdd( std::string profile_name )
throw( db_action_failed );
- void ProfileDelete( string profile_name )
+ void ProfileDelete( std::string profile_name )
throw( db_action_failed );
- void ProfileAddResource( string profile_name, string resource_name, string resource_type )
+ void ProfileAddResource( std::string profile_name, std::string resource_name, std::string resource_type )
throw( db_action_failed );
- void ProfileDeleteResource( string profile_name, string resource_name, string resource_type )
+ void ProfileDeleteResource( std::string profile_name, std::string resource_name, std::string resource_type )
throw( db_action_failed );
- void ProfileClearResources( string profile_name, string resource_type="all" )
+ void ProfileClearResources( std::string profile_name, std::string resource_type="all" )
throw( db_action_failed );
- bool ProfileHasResource( string profile_name, string resource_name, string resource_type )
+ bool ProfileHasResource( std::string profile_name, std::string resource_name, std::string resource_type )
throw( db_action_failed );
- bool ProfileGetFlag( string profile, string flag )
+ bool ProfileGetFlag( std::string profile, std::string flag )
throw( db_action_failed );
- void ProfileSetFlag( string profile, string flag, bool value )
+ void ProfileSetFlag( std::string profile, std::string flag, bool value )
throw( db_action_failed );
- string ProfileGetKey( string profile, string key )
+ std::string ProfileGetKey( std::string profile, std::string key )
throw( db_action_failed );
- void ProfileSetKey( string profile, string key, string value )
+ void ProfileSetKey( std::string profile, std::string key, std::string value )
throw( db_action_failed );
- string ProfileGetScript( string profile, string script_name )
+ std::string ProfileGetScript( std::string profile, std::string script_name )
throw( db_action_failed );
- void ProfileSetScript( string profile, string script_name, string script_location )
+ void ProfileSetScript( std::string profile, std::string script_name, std::string script_location )
throw( db_action_failed );
- vector<string> ProfileGetResourceTypes( string profile )
+ std::vector<std::string> ProfileGetResourceTypes( std::string profile )
throw( db_action_failed );
- vector<string> ProfileGetResources( string profile, string resource_type )
+ std::vector<std::string> ProfileGetResources( std::string profile, std::string resource_type )
throw( db_action_failed );
// generic access functions
- void Dump( ostream &output, string key="root" )
+ void Dump( std::ostream &output, std::string key="root" )
throw( db_action_failed );
- void SetValue( string key, string value )
+ void SetValue( std::string key, std::string value )
throw( db_action_failed );
- string GetValue( string key )
+ std::string GetValue( std::string key )
throw( db_action_failed );
- void AddNodes( string key, string value="" ) throw( db_action_failed );
- void DeleteNodes( string key ) throw( db_action_failed );
- void RenameNodes( string key, string name ) throw( db_action_failed );
+ void AddNodes( std::string key, std::string value="" ) throw( db_action_failed );
+ void DeleteNodes( std::string key ) throw( db_action_failed );
+ void RenameNodes( std::string key, std::string name ) throw( db_action_failed );
// SCDB file interface helpers
struct no_such_file{};
struct file_exists{};
- bool FileExists( const string &profile, const string &resource_type,
- const string &resource_name )
+ bool FileExists( const std::string &profile, const std::string &resource_type,
+ const std::string &resource_name )
throw( db_action_failed );
- void FileSave( const string &profile, const string &resource_type,
- const string &resource_name, istream &in, struct stat *st=NULL)
+ void FileSave( const std::string &profile, const std::string &resource_type,
+ const std::string &resource_name, std::istream &in, struct stat *st=NULL)
throw( db_action_failed );
- void FileRestore( const string &profile, const string &resource_type,
- const string &resource_name, ostream &out,
+ void FileRestore( const std::string &profile, const std::string &resource_type,
+ const std::string &resource_name, std::ostream &out,
struct stat *st=NULL )
throw( db_action_failed, no_such_file );
- void FileCopy( const string &profile, const string &dest_profile, const string &resource_type,
- const string &resource_name )
+ void FileCopy( const std::string &profile, const std::string &dest_profile, const std::string &resource_type,
+ const std::string &resource_name )
throw( db_action_failed, no_such_file, file_exists );
- void FileDelete( const string &profile, const string &resource_type,
- const string &resource_name )
+ void FileDelete( const std::string &profile, const std::string &resource_type,
+ const std::string &resource_name )
throw( db_action_failed, no_such_file );
- string &FileGetMD5( const string &profile, const string &resource_type,
- const string &resource_name )
+ std::string &FileGetMD5( const std::string &profile, const std::string &resource_type,
+ const std::string &resource_name )
throw( db_action_failed, no_such_file );
- bool FileHasBackup( const string &profile, const string &resource_type,
- const string &resource_name );
+ bool FileHasBackup( const std::string &profile, const std::string &resource_type,
+ const std::string &resource_name );
private:
static SCDB * scdb_handle;
Index: src/cli/db_commands.h
===================================================================
--- src/cli/db_commands.h.orig 2012-07-04 17:43:16.921373780 +0200
+++ src/cli/db_commands.h 2012-07-04 17:43:59.443350601 +0200
@@ -17,31 +17,29 @@
#ifndef COMMANDS_H
#define COMMANDS_H
-using namespace std;
-
#include "globals.h"
#include <string>
#include <vector>
-void cmd_help( vector<string> &args );
-void cmd_load( vector<string> &args );
-void cmd_save( vector<string> &args );
-void cmd_info( vector<string> &args );
-void cmd_db_version( vector<string> &args );
-void cmd_scpm_version( vector<string> &args );
-void cmd_create( vector<string> &args );
-void cmd_drop( vector<string> &args );
-void cmd_dump( vector<string> &args );
-void cmd_show( vector<string> &args );
-void cmd_minimize( vector<string> &args );
-void cmd_maximize( vector<string> &args );
-void cmd_customize( vector<string> &args );
-void cmd_rebuild_deps( vector<string> &args );
-void cmd_convert( vector<string> &args );
-void cmd_clean( vector<string> &args );
-void cmd_get( vector<string> &args );
-void cmd_set( vector<string> &args );
-void cmd_export( vector<string> &args );
-void cmd_import( vector<string> &args );
+void cmd_help( std::vector<std::string> &args );
+void cmd_load( std::vector<std::string> &args );
+void cmd_save( std::vector<std::string> &args );
+void cmd_info( std::vector<std::string> &args );
+void cmd_db_version( std::vector<std::string> &args );
+void cmd_scpm_version( std::vector<std::string> &args );
+void cmd_create( std::vector<std::string> &args );
+void cmd_drop( std::vector<std::string> &args );
+void cmd_dump( std::vector<std::string> &args );
+void cmd_show( std::vector<std::string> &args );
+void cmd_minimize( std::vector<std::string> &args );
+void cmd_maximize( std::vector<std::string> &args );
+void cmd_customize( std::vector<std::string> &args );
+void cmd_rebuild_deps( std::vector<std::string> &args );
+void cmd_convert( std::vector<std::string> &args );
+void cmd_clean( std::vector<std::string> &args );
+void cmd_get( std::vector<std::string> &args );
+void cmd_set( std::vector<std::string> &args );
+void cmd_export( std::vector<std::string> &args );
+void cmd_import( std::vector<std::string> &args );
#endif
Index: src/main/executor.hh
===================================================================
--- src/main/executor.hh.orig 2012-07-04 17:43:16.922373756 +0200
+++ src/main/executor.hh 2012-07-04 17:43:59.443350601 +0200
@@ -18,8 +18,6 @@
#ifndef EXECUTOR_H
#define EXECUTOR_H
-using namespace std;
-
#include <string>
#include <vector>
#include <iostream>
@@ -30,17 +28,17 @@ public:
struct exec_failed {};
- Executor( string filename );
+ Executor( std::string filename );
~Executor( );
//int Run( streambuf *outbuf, streambuf *inbuf ) throw( exec_failed );
- //int Run( vector<string> &out_strings, iostream &command_errstream ) throw( exec_failed );
- int Run( vector<string> &out_strings, vector<string> &err_strings ) throw( exec_failed );
- int Run( string &logdir, bool verbose=true ) throw( exec_failed );
+ //int Run( vector<std::string> &out_std::strings, iostream &command_errstream ) throw( exec_failed );
+ int Run( std::vector<std::string> &out_strings, std::vector<std::string> &err_strings ) throw( exec_failed );
+ int Run( std::string &logdir, bool verbose=true ) throw( exec_failed );
private:
- string fname;
+ std::string fname;
char *args[20];
int num_args;
@@ -50,13 +48,13 @@ class Script
{
public:
- Script( const string &filename );
+ Script( const std::string &filename );
void Exec();
private:
- const string &scriptfile;
+ const std::string &scriptfile;
};
Index: src/main/log.hh
===================================================================
--- src/main/log.hh.orig 2012-07-04 17:43:16.922373756 +0200
+++ src/main/log.hh 2012-07-04 17:43:59.443350601 +0200
@@ -18,8 +18,6 @@
#ifndef LOG_H
#define LOG_H
-using namespace std;
-
#include <string>
#include <sstream>
#include <scpm_types.h>
@@ -65,10 +63,10 @@ public:
static const int EXIT_WARNING = 1;
void SetLog( logtype_t log_type, logmode_t logmode );
- void WriteMessage( string module_name, logclass_t log_class, string message,
- string action="" );
- void WriteRawMessage( logclass_t log_class, string message, string action="" );
- string GetLastMessage();
+ void WriteMessage( std::string module_name, logclass_t log_class, std::string message,
+ std::string action="" );
+ void WriteRawMessage( logclass_t log_class, std::string message, std::string action="" );
+ std::string GetLastMessage();
bool Aborted( ) { return aborted; };
void ClearAborted( ) { aborted = false; };
@@ -79,7 +77,7 @@ public:
static const struct error_t{} error;
// logging operations
- Log &operator<<( string s);
+ Log &operator<<( std::string s);
Log &operator<<( char c );
Log &operator<<( long i );
Log &operator<<( unsigned long i );
@@ -95,8 +93,8 @@ public:
Log &operator<<( warning_t &a );
Log &operator<<( error_t &a );
- string trans( string raw );
- string untrans( string raw );
+ std::string trans( std::string raw );
+ std::string untrans( std::string raw );
private:
@@ -105,13 +103,13 @@ private:
static Log *log_handle;
- static string last_error;
+ static std::string last_error;
static int log_type;
static int log_mode;
static int exit_mode;
static int current_class;
- static stringstream buf;
+ static std::stringstream buf;
bool aborted;
};
Index: src/main/modlib.hh
===================================================================
--- src/main/modlib.hh.orig 2012-07-04 17:43:16.922373756 +0200
+++ src/main/modlib.hh 2012-07-04 17:43:59.443350601 +0200
@@ -17,8 +17,6 @@
#ifndef MODLIB_H
#define MODLIB_H
-using namespace std;
-
#include <string>
#include <vector>
#include <iostream>
@@ -29,13 +27,15 @@ public:
struct handler_not_available {};
- string GetMD5sum( string filename );
- string GetMD5sum( istream &input );
+ std::string GetMD5sum( std::string filename );
+ std::string GetMD5sum( std::istream &input );
- int CallHandler( string resource_type, string resource_name,
- string action, string args, vector<string> &output, vector<string> &errout )
+ int CallHandler( std::string resource_type, std::string resource_name,
+ std::string action, std::string args,
+ std::vector<std::string> &output,
+ std::vector<std::string> &errout )
throw( handler_not_available );
- bool HasHandler( string resource_type, string resource_name, string action );
+ bool HasHandler( std::string resource_type, std::string resource_name, std::string action );
};
Index: src/main/profile.hh
===================================================================
--- src/main/profile.hh.orig 2012-07-04 17:43:16.922373756 +0200
+++ src/main/profile.hh 2012-07-04 17:43:59.443350601 +0200
@@ -18,8 +18,6 @@
#ifndef PROFILE_H
#define PROFILE_H
-using namespace std;
-
#include <scdb.hh>
#include "resource.hh"
#include "log.hh"
@@ -30,10 +28,10 @@ class Profile
{
public:
- Profile( string profile_name );
+ Profile( std::string profile_name );
~Profile( );
- string GetName( ) { return name; };
+ std::string GetName( ) { return name; };
bool IsClean( );
bool IsActive( );
@@ -41,9 +39,9 @@ public:
void SetInactive( );
void Remove( );
void Restore( );
- void SetRoot( string root, bool is_profile_root );
- vector<string> GetResources( string resource_type );
- vector<string> GetModifiedResources( string resource_type );
+ void SetRoot( std::string root, bool is_profile_root );
+ std::vector<std::string> GetResources( std::string resource_type );
+ std::vector<std::string> GetModifiedResources( std::string resource_type );
void DetermineResourceActions( );
// script helpers
@@ -51,36 +49,36 @@ public:
void ScriptRunPostStart( );
void ScriptRunPreStop ( );
void ScriptRunPostStop ( );
- void ScriptSetPreStart ( istream &input );
- void ScriptSetPostStart( istream &input );
- void ScriptSetPreStop ( istream &input );
- void ScriptSetPostStop ( istream &input );
- void ScriptGetPreStart ( ostream &output );
- void ScriptGetPostStart( ostream &output );
- void ScriptGetPreStop ( ostream &output );
- void ScriptGetPostStop ( ostream &output );
+ void ScriptSetPreStart ( std::istream &input );
+ void ScriptSetPostStart( std::istream &input );
+ void ScriptSetPreStop ( std::istream &input );
+ void ScriptSetPostStop ( std::istream &input );
+ void ScriptGetPreStart ( std::ostream &output );
+ void ScriptGetPostStart( std::ostream &output );
+ void ScriptGetPreStop ( std::ostream &output );
+ void ScriptGetPostStop ( std::ostream &output );
void ScriptUnsetPreStart ( );
void ScriptUnsetPostStart( );
void ScriptUnsetPreStop ( );
void ScriptUnsetPostStop ( );
- bool HasScript( string scriptname );
+ bool HasScript( std::string scriptname );
private:
- const string module_name;
+ const std::string module_name;
SCDB *db;
Log *log;
- string name;
+ std::string name;
bool clean;
- vector<string> resources;
- vector<Resource*> resources_to_start;
- vector<Resource*> resources_to_stop;
- vector<Resource*> resources_keep_running;
-
- void SaveScript( string scriptname, istream &input );
- void DumpScript( string scriptname, ostream &output );
- void RemoveScript( string scriptname );
- void RunScript( string scriptname );
+ std::vector<std::string> resources;
+ std::vector<Resource*> resources_to_start;
+ std::vector<Resource*> resources_to_stop;
+ std::vector<Resource*> resources_keep_running;
+
+ void SaveScript( std::string scriptname, std::istream &input );
+ void DumpScript( std::string scriptname, std::ostream &output );
+ void RemoveScript( std::string scriptname );
+ void RunScript( std::string scriptname );
};
Index: src/main/progress.hh
===================================================================
--- src/main/progress.hh.orig 2012-07-04 17:43:16.922373756 +0200
+++ src/main/progress.hh 2012-07-04 17:43:59.443350601 +0200
@@ -18,8 +18,6 @@
#ifndef PROGRESS_H
#define PROGRESS_H
-using namespace std;
-
#include <iostream>
#include <string>
@@ -37,7 +35,7 @@ public:
void SetOutputMode( int flags );
void SetBar( int bar_length=100 );
- void Print( const string &info, int verbose=0 );
+ void Print( const std::string &info, int verbose=0 );
void Newline( int verbose=0 );
void SetSegment( int percent );
void SetSegmentSteps( int steps );
@@ -46,13 +44,13 @@ public:
private:
- Progress( ostream &info_out, ostream &hash_out );
+ Progress( std::ostream &info_out, std::ostream &hash_out );
~Progress( );
static Progress *progress;
- ostream &output_info;
- ostream &output_hash;
+ std::ostream &output_info;
+ std::ostream &output_hash;
int vlev;
int output_flags;
int abs_length;
Index: src/main/resource.hh
===================================================================
--- src/main/resource.hh.orig 2012-07-04 17:43:16.922373756 +0200
+++ src/main/resource.hh 2012-07-04 17:43:59.443350601 +0200
@@ -18,8 +18,6 @@
#ifndef RESOURCE_H
#define RESOURCE_H
-using namespace std;
-
#include <scdb.hh>
#include <string>
#include <vector>
@@ -35,9 +33,9 @@ public:
virtual ~Resource( );
- string &GetName( ) { return name; };
- string &GetProfile( ) { return profile; };
- virtual string GetType( ) { return "__unknown"; };
+ std::string &GetName( ) { return name; };
+ std::string &GetProfile( ) { return profile; };
+ virtual std::string GetType( ) { return "__unknown"; };
// Resource status functions
virtual bool Modified( ) throw( not_available );
@@ -45,7 +43,7 @@ public:
virtual bool Active( ) throw( not_available );
virtual bool Running( ) throw( not_available );
virtual bool NeedsUpdate( ) throw( not_available );
- virtual bool ModifiedInProfile( const string &dest_profile ) throw( not_available );
+ virtual bool ModifiedInProfile( const std::string &dest_profile ) throw( not_available );
virtual bool HasSystemAlternative( ) throw( not_available );
virtual bool HasSystemBackup( ) throw( not_available );
virtual bool HasBackup( ) throw( not_available );
@@ -56,19 +54,19 @@ public:
virtual bool Start( ) throw( not_available );
virtual bool Stop( ) throw( not_available );
virtual bool Restart( ) throw( not_available );
- virtual bool Patch( const string &ref_profile ) throw( not_available );
+ virtual bool Patch( const std::string &ref_profile ) throw( not_available );
virtual bool AddBackup( ) throw( not_available );
- virtual bool RestoreBackup( const string * version = NULL ) throw( not_available );
- virtual bool RemoveBackup( const string * version = NULL ) throw( not_available );
- virtual bool Export( const string &root ) throw( not_available );
- virtual bool Import( const string &root ) throw( not_available );
+ virtual bool RestoreBackup( const std::string * version = NULL ) throw( not_available );
+ virtual bool RemoveBackup( const std::string * version = NULL ) throw( not_available );
+ virtual bool Export( const std::string &root ) throw( not_available );
+ virtual bool Import( const std::string &root ) throw( not_available );
- virtual vector< pair<time_t, string> > GetBackupVersions( ) throw (not_available);
- virtual vector<string> GetDependencies( string resource_type ) throw( not_available );
+ virtual std::vector< std::pair<time_t, std::string> > GetBackupVersions( ) throw (not_available);
+ virtual std::vector<std::string> GetDependencies( std::string resource_type ) throw( not_available );
virtual int GetStartPriority( ) throw( not_available );
virtual int GetStopPriority( ) throw( not_available );
- virtual void ShowChanges( ostream &output, bool backup=false, string version="" ) throw( not_available );
+ virtual void ShowChanges( std::ostream &output, bool backup=false, std::string version="" ) throw( not_available );
virtual bool Refresh( ) throw( not_available );
// Resource database functions
@@ -76,26 +74,26 @@ public:
void WriteData( );
// Profile specific data
- void SetProfile( string profile_name ) { profile = profile_name; };
- void SetResourceRoot( string root );
+ void SetProfile( std::string profile_name ) { profile = profile_name; };
+ void SetResourceRoot( std::string root );
protected:
- Resource( string name_string, string type_string, bool allow_missing ) throw( resource_unknown );
+ Resource( std::string name_string, std::string type_string, bool allow_missing ) throw( resource_unknown );
- string name;
- string type;
+ std::string name;
+ std::string type;
bool missok;
struct data_element {
- string data_name;
- string data_value;
+ std::string data_name;
+ std::string data_value;
};
- vector<data_element> resource_data;
+ std::vector<data_element> resource_data;
- string profile;
- string resource_root;
+ std::string profile;
+ std::string resource_root;
private:
Index: src/main/resource_helpers.hh
===================================================================
--- src/main/resource_helpers.hh.orig 2012-07-04 17:43:16.922373756 +0200
+++ src/main/resource_helpers.hh 2012-07-04 17:43:59.444350577 +0200
@@ -18,8 +18,6 @@
#ifndef RESOURCE_HELPERS_H
#define RESOURCE_HELPERS_H
-using namespace std;
-
#include <resource.hh>
#include <vector>
#include <scdb.hh>
@@ -44,16 +42,16 @@ public:
};
~Resource_helpers( );
- vector<string> GetResourceTypes( ) { return module_names; };
- vector<string> GetResourceNames( string resource_type );
- Resource *CreateObject( string resource_type, string resource_name, bool allow_missing=false )
+ std::vector<std::string> GetResourceTypes( ) { return module_names; };
+ std::vector<std::string> GetResourceNames( std::string resource_type );
+ Resource *CreateObject( std::string resource_type, std::string resource_name, bool allow_missing=false )
throw ( type_invalid, Resource::resource_unknown );
private:
Log *log;
- vector<string> module_names;
+ std::vector<std::string> module_names;
};
Index: src/main/scpm_conf.hh
===================================================================
--- src/main/scpm_conf.hh.orig 2012-07-04 17:43:16.922373756 +0200
+++ src/main/scpm_conf.hh 2012-07-04 17:43:59.444350577 +0200
@@ -18,8 +18,6 @@
#ifndef SCPM_CONF_H
#define SCPM_CONF_H
-using namespace std;
-
#include <string>
class SCPM_conf
@@ -32,19 +30,19 @@ public:
struct scpm_panic{};
static SCPM_conf * GetHandle( ) { return handle; };
- string GetInitDir( ) { return initdir; };
- string GetLibDir( ) { return libdir; };
- string GetDBFile( ) { return dbfile; };
- string GetLogfile( ) { return logfile; };
- string GetRPMFile( ) { return rpmfile; };
- string GetResourceSet( ) { return resource_set; };
- string GetSetDir( ) { return libdir+"/resource_sets"; };
- string GetUserSetDir( ) { return "/var/lib/scpm/resource_sets"; };
- string GetGroupDir( ) { return libdir+"/resource_groups"; };
- string GetUserGroupDir( ) { return "/var/lib/scpm/resource_groups"; };
- string GetGroupsFile( ) { return groupsfile; };
- string GetProfileDir( ) { return profiledir; };
- string GetBootMode( ) { return boot_mode_str; };
+ std::string GetInitDir( ) { return initdir; };
+ std::string GetLibDir( ) { return libdir; };
+ std::string GetDBFile( ) { return dbfile; };
+ std::string GetLogfile( ) { return logfile; };
+ std::string GetRPMFile( ) { return rpmfile; };
+ std::string GetResourceSet( ) { return resource_set; };
+ std::string GetSetDir( ) { return libdir+"/resource_sets"; };
+ std::string GetUserSetDir( ) { return "/var/lib/scpm/resource_sets"; };
+ std::string GetGroupDir( ) { return libdir+"/resource_groups"; };
+ std::string GetUserGroupDir( ) { return "/var/lib/scpm/resource_groups"; };
+ std::string GetGroupsFile( ) { return groupsfile; };
+ std::string GetProfileDir( ) { return profiledir; };
+ std::string GetBootMode( ) { return boot_mode_str; };
void SetOptions( int options );
bool LogToStderr( ) { return log_to_stderr; };
bool LogToFile( ) { return log_to_file; };
@@ -67,16 +65,16 @@ public:
bool WaitCommit( ) { return wait_commit; };
// you can also set some values
- void SetLibDir( string value ) { libdir = value; changed = true; };
- void SetDBFile( string value ) { dbfile = value; changed = true; };
- void SetLogFile( string value ) { logfile = value; changed = true; };
- void SetResourceSet( string value ) { resource_set = value; changed = true; };
+ void SetLibDir( std::string value ) { libdir = value; changed = true; };
+ void SetDBFile( std::string value ) { dbfile = value; changed = true; };
+ void SetLogFile( std::string value ) { logfile = value; changed = true; };
+ void SetResourceSet( std::string value ) { resource_set = value; changed = true; };
void SetBootMode( bool value ) { boot_mode = value; };
// support for setting some options
struct io_error{};
struct no_such_option{};
- void SaveOption( const string &option, const string &value )
+ void SaveOption( const std::string &option, const std::string &value )
throw( io_error, no_such_option );
private:
@@ -85,15 +83,15 @@ private:
~SCPM_conf();
void SaveConfig();
- string initdir;
- string dbfile;
- string libdir;
- string logfile;
- string rpmfile;
- string profiledir;
- string resource_set;
- string groupsfile;
- string boot_mode_str;
+ std::string initdir;
+ std::string dbfile;
+ std::string libdir;
+ std::string logfile;
+ std::string rpmfile;
+ std::string profiledir;
+ std::string resource_set;
+ std::string groupsfile;
+ std::string boot_mode_str;
bool log_to_syslog;
bool log_to_stderr;
bool log_to_file;
@@ -115,7 +113,7 @@ private:
bool wait_commit;
bool changed;
- string cfg_fname;
+ std::string cfg_fname;
static SCPM_conf *handle;
};
Index: src/main/scpm_helpers.hh
===================================================================
--- src/main/scpm_helpers.hh.orig 2012-07-04 17:43:16.922373756 +0200
+++ src/main/scpm_helpers.hh 2012-07-04 17:43:59.444350577 +0200
@@ -18,8 +18,6 @@
#ifndef SCPM_HELPERS_H
#define SCPM_HELPERS_H
-using namespace std;
-
#include <string>
#include <scdb.hh>
@@ -55,57 +53,57 @@ public:
void SaveInstallInfo( );
// profile specific helpers
- bool ProfileExists( string profile );
- const string GetActiveProfile( );
- const vector<string> GetAllProfiles( );
- void SetActiveProfile( string profile );
- void CreateNewProfile( string profile_name );
- void CloneProfile( string profile, string source_profile );
- void RemoveProfile( string profile );
- void SetScript( string profile, string script_type, string script_name );
- string GetScript( string profile, string script_type );
- void SetDescription( string profile, string description );
- string GetDescription( string profile );
- void AddProfileResources( string profile );
+ bool ProfileExists( std::string profile );
+ const std::string GetActiveProfile( );
+ const std::vector<std::string> GetAllProfiles( );
+ void SetActiveProfile( std::string profile );
+ void CreateNewProfile( std::string profile_name );
+ void CloneProfile( std::string profile, std::string source_profile );
+ void RemoveProfile( std::string profile );
+ void SetScript( std::string profile, std::string script_type, std::string script_name );
+ std::string GetScript( std::string profile, std::string script_type );
+ void SetDescription( std::string profile, std::string description );
+ std::string GetDescription( std::string profile );
+ void AddProfileResources( std::string profile );
// resource specific helpers
void CreateResources( );
- const vector<string> GetResourceTypes( );
- const vector<string> GetResourceNames( string &resource_type );
- void CopyResources( const string &src_profile, const string &dest_profile );
+ const std::vector<std::string> GetResourceTypes( );
+ const std::vector<std::string> GetResourceNames( std::string &resource_type );
+ void CopyResources( const std::string &src_profile, const std::string &dest_profile );
// resource action specific helpers
- void DetermineResourceActions( Profile &active, Profile &dest, vector<Resource*> &to_start,
- vector<Resource*> &to_stop, vector<Resource*> &keep_runnning );
- void StopResources( vector<Resource*> &to_stop );
- void StartResources( vector<Resource*> &to_start );
+ void DetermineResourceActions( Profile &active, Profile &dest, std::vector<Resource*> &to_start,
+ std::vector<Resource*> &to_stop, std::vector<Resource*> &keep_runnning );
+ void StopResources( std::vector<Resource*> &to_stop );
+ void StartResources( std::vector<Resource*> &to_start );
void ResolveDeps( Profile &active_profile, Profile &dest_profile,
- vector<Resource*> &resources, vector<Resource*> &affected );
- void OrderResources( vector<Resource*> &resources, bool stop );
+ std::vector<Resource*> &resources, std::vector<Resource*> &affected );
+ void OrderResources( std::vector<Resource*> &resources, bool stop );
// resource special save method helpers
- void ApplyAll( const string &resource_type, const string &resource_name );
- void PatchAll( const string &resource_type, const string &resource_name );
+ void ApplyAll( const std::string &resource_type, const std::string &resource_name );
+ void PatchAll( const std::string &resource_type, const std::string &resource_name );
// resource group stuff
- string &GetGroupDescription( const string &group );
- bool GroupActive( const string &group );
- bool GroupDeleted( const string &group );
+ std::string &GetGroupDescription( const std::string &group );
+ bool GroupActive( const std::string &group );
+ bool GroupDeleted( const std::string &group );
// other helpers
void WriteBootInfo( );
void ClearBootInfo( );
- void RunScript( const string &scriptfile );
- void RestoreResources( const string &profile, const vector<pair<string, string> > &resources );
- void SaveResources( const string &profile, const vector<pair<string, string> > &resources );
+ void RunScript( const std::string &scriptfile );
+ void RestoreResources( const std::string &profile, const std::vector<std::pair<std::string, std::string> > &resources );
+ void SaveResources( const std::string &profile, const std::vector<std::pair<std::string, std::string> > &resources );
void UpdateResources( );
- void CheckResources( vector<pair<string, string> > &resources );
- void AddBackup ( const vector<pair<string, string> > &resources );
- void RemoveBackup ( const vector<Resource*> &resources, const vector<string> &versions );
- void RestoreBackup ( const vector<Resource*> &resources, const vector<string> &versions );
- vector<Resource*> &GetResourcesWithBackup( string profile="", bool verbose=false );
- vector<Resource*> &GetResourcesByName( const string &profile,
- vector<pair<string,string> > resources );
+ void CheckResources( std::vector<std::pair<std::string, std::string> > &resources );
+ void AddBackup ( const std::vector<std::pair<std::string, std::string> > &resources );
+ void RemoveBackup ( const std::vector<Resource*> &resources, const std::vector<std::string> &versions );
+ void RestoreBackup ( const std::vector<Resource*> &resources, const std::vector<std::string> &versions );
+ std::vector<Resource*> &GetResourcesWithBackup( std::string profile="", bool verbose=false );
+ std::vector<Resource*> &GetResourcesByName( const std::string &profile,
+ std::vector<std::pair<std::string,std::string> > resources );
// journal stuff
void PerformCommand( Journal::entry &e );
@@ -113,24 +111,24 @@ public:
void ProcessJournal( bool nowait=false );
// resource group stuff
- void SetResourceGroup(const string &name, const vector<resource_entry_t> &group,
- const string &description );
- void DeleteResourceGroup( const string &group );
- void RenameResourceGroup( const string &group, const string &newgroup );
- void SetActiveResourceGroups( const vector<string> &groups );
- void GetActiveResourceGroups( vector<string> &groups );
- void ActivateResourceGroup( const string &group, bool auto_add=false );
- void DeactivateResourceGroup( const string &group, bool auto_remove=false );
- void ResetResourceGroup( const string &group );
+ void SetResourceGroup(const std::string &name, const std::vector<resource_entry_t> &group,
+ const std::string &description );
+ void DeleteResourceGroup( const std::string &group );
+ void RenameResourceGroup( const std::string &group, const std::string &newgroup );
+ void SetActiveResourceGroups( const std::vector<std::string> &groups );
+ void GetActiveResourceGroups( std::vector<std::string> &groups );
+ void ActivateResourceGroup( const std::string &group, bool auto_add=false );
+ void DeactivateResourceGroup( const std::string &group, bool auto_remove=false );
+ void ResetResourceGroup( const std::string &group );
void ResetAllGroups( );
- void GetResourceGroup( const string &name, vector<resource_entry_t> &group,
- string &description, bool nouser );
+ void GetResourceGroup( const std::string &name, std::vector<resource_entry_t> &group,
+ std::string &description, bool nouser );
bool stay_locked;
private:
void SetScriptEnv( );
- void Call( string command );
+ void Call( std::string command );
SCDB *db;
Log *log;
Index: src/main/storage.hh
===================================================================
--- src/main/storage.hh.orig 2012-07-04 17:43:16.922373756 +0200
+++ src/main/storage.hh 2012-07-04 17:43:59.444350577 +0200
@@ -17,8 +17,6 @@
#ifndef STORAGE_H
#define STORAGE_H
-using namespace std;
-
#include <string>
#include <fstream>
#include <iostream>
@@ -35,20 +33,20 @@ public:
Storage() {};
~Storage() {};
- void Save( string profile, string category, string name, istream &data )
+ void Save( std::string profile, std::string category, std::string name, std::istream &data )
throw( no_access );
- void Restore( string profile, string category, string name, ostream &data )
+ void Restore( std::string profile, std::string category, std::string name, std::ostream &data )
throw( invalid, no_access );
- string MD5sum( string profile, string category, string name );
- void SaveAttribs( string profile, string category, string name, struct stat &st )
+ std::string MD5sum( std::string profile, std::string category, std::string name );
+ void SaveAttribs( std::string profile, std::string category, std::string name, struct stat &st )
throw( invalid, no_access );
- void GetAttribs( string profile, string category, string name, struct stat &st )
+ void GetAttribs( std::string profile, std::string category, std::string name, struct stat &st )
throw( invalid, no_access );
private:
- string GetFilename( string directory, string data_name, bool create=true );
- void SetIndex( string directory, string filename );
+ std::string GetFilename( std::string directory, std::string data_name, bool create=true );
+ void SetIndex( std::string directory, std::string filename );
};
Index: src/scdb/scdb.hh
===================================================================
--- src/scdb/scdb.hh.orig 2012-07-04 17:43:16.922373756 +0200
+++ src/scdb/scdb.hh 2012-07-04 17:43:59.444350577 +0200
@@ -17,8 +17,6 @@
#ifndef SCDB_H
#define SCDB_H
-using namespace std;
-
#include <vector>
#include <string>
#include <iostream>
@@ -39,21 +37,21 @@ public:
typedef LocalFile backend_file;
struct dbinfo_t {
- string version;
- string type;
+ std::string version;
+ std::string type;
bool is_local;
};
struct resource_dep_t {
- string name;
- string type;
+ std::string name;
+ std::string type;
};
struct db_action_failed
{
public:
- db_action_failed( string r ) { reason = r; };
- string reason;
+ db_action_failed( std::string r ) { reason = r; };
+ std::string reason;
};
static const int db_state_ok = 0;
@@ -66,142 +64,142 @@ public:
// scdb specific functions
struct dbinfo_t GetDBInfo( );
int LoadDB( ) throw( db_action_failed );
- int LoadDB( string dbfile ) throw( db_action_failed );
- int LoadDB( istream &input, bool quick=false ) throw( db_action_failed );
+ int LoadDB( std::string dbfile ) throw( db_action_failed );
+ int LoadDB( std::istream &input, bool quick=false ) throw( db_action_failed );
void SaveDB( ) throw( db_action_failed );
- void SaveDB( ostream &output ) throw( db_action_failed );
+ void SaveDB( std::ostream &output ) throw( db_action_failed );
void DropDB( );
bool Modified( ) { return modified; };
- string GetSCDBVersion( );
- void SetSCDBVersion( string version );
- string GetFormat( ) { return "xml"; };
- string GetFormatVersion( );
+ std::string GetSCDBVersion( );
+ void SetSCDBVersion( std::string version );
+ std::string GetFormat( ) { return "xml"; };
+ std::string GetFormatVersion( );
bool UpToDate();
// scdb global functions
- void SetStatusFlag( string status_flag, bool value ) throw( db_action_failed );
- bool GetStatusFlag( string status_flag ) throw( db_action_failed );
- void SetStatusKey( string status_key, string value ) throw( db_action_failed );
- string GetStatusKey( string status_key ) throw( db_action_failed );
- void SetActiveProfile( string profile_name ) throw( db_action_failed );
- string GetActiveProfile( ) throw( db_action_failed );
- vector<string> GetProfiles( ) throw( db_action_failed );
+ void SetStatusFlag( std::string status_flag, bool value ) throw( db_action_failed );
+ bool GetStatusFlag( std::string status_flag ) throw( db_action_failed );
+ void SetStatusKey( std::string status_key, std::string value ) throw( db_action_failed );
+ std::string GetStatusKey( std::string status_key ) throw( db_action_failed );
+ void SetActiveProfile( std::string profile_name ) throw( db_action_failed );
+ std::string GetActiveProfile( ) throw( db_action_failed );
+ std::vector<std::string> GetProfiles( ) throw( db_action_failed );
// resource functions
- bool ResourceExists( string resource_name, string resource_type )
+ bool ResourceExists( std::string resource_name, std::string resource_type )
throw( db_action_failed );
- void ResourceAdd( string resource_name, string resource_type )
+ void ResourceAdd( std::string resource_name, std::string resource_type )
throw( db_action_failed );
- void ResourceAddType( string resource_type )
+ void ResourceAddType( std::string resource_type )
throw( db_action_failed );
- void ResourceDelete( string resource_name, string resource_type )
+ void ResourceDelete( std::string resource_name, std::string resource_type )
throw( db_action_failed );
- void ResourceAddDep( string resource_name, string resource_type, string dep_name, string dep_type )
+ void ResourceAddDep( std::string resource_name, std::string resource_type, std::string dep_name, std::string dep_type )
throw( db_action_failed );
- void ResourceCleanDeps( string resource_name, string resource_type )
+ void ResourceCleanDeps( std::string resource_name, std::string resource_type )
throw( db_action_failed );
- vector<resource_dep_t> ResourceGetDeps( string resource_name, string resource_type )
+ std::vector<resource_dep_t> ResourceGetDeps( std::string resource_name, std::string resource_type )
throw( db_action_failed );
- vector<string> ResourceGetTypes( )
+ std::vector<std::string> ResourceGetTypes( )
throw( db_action_failed );
- vector<string> ResourceGetNames( string resource_type )
+ std::vector<std::string> ResourceGetNames( std::string resource_type )
throw( db_action_failed );
- void ResourceAddData( string resource_name, string resource_type,
- string data_entry, string data_value )
+ void ResourceAddData( std::string resource_name, std::string resource_type,
+ std::string data_entry, std::string data_value )
throw( db_action_failed );
- void ResourceClearData( string resource_name, string resource_type )
+ void ResourceClearData( std::string resource_name, std::string resource_type )
throw( db_action_failed );
- void ResourceGetData( string resource_name, string resource_type,
- vector<string> &data_entries, vector<string> &data_values )
+ void ResourceGetData( std::string resource_name, std::string resource_type,
+ std::vector<std::string> &data_entries, std::vector<std::string> &data_values )
throw( db_action_failed );
// profile functions
- bool ProfileExists( string profile_name )
+ bool ProfileExists( std::string profile_name )
throw( db_action_failed );
- void ProfileAdd( string profile_name )
+ void ProfileAdd( std::string profile_name )
throw( db_action_failed );
- void ProfileDelete( string profile_name )
+ void ProfileDelete( std::string profile_name )
throw( db_action_failed );
- void ProfileAddResource( string profile_name, string resource_name, string resource_type )
+ void ProfileAddResource( std::string profile_name, std::string resource_name, std::string resource_type )
throw( db_action_failed );
- void ProfileDeleteResource( string profile_name, string resource_name, string resource_type )
+ void ProfileDeleteResource( std::string profile_name, std::string resource_name, std::string resource_type )
throw( db_action_failed );
- void ProfileClearResources( string profile_name, string resource_type="all" )
+ void ProfileClearResources( std::string profile_name, std::string resource_type="all" )
throw( db_action_failed );
- bool ProfileHasResource( string profile_name, string resource_name, string resource_type )
+ bool ProfileHasResource( std::string profile_name, std::string resource_name, std::string resource_type )
throw( db_action_failed );
- bool ProfileGetFlag( string profile, string flag )
+ bool ProfileGetFlag( std::string profile, std::string flag )
throw( db_action_failed );
- void ProfileSetFlag( string profile, string flag, bool value )
+ void ProfileSetFlag( std::string profile, std::string flag, bool value )
throw( db_action_failed );
- string ProfileGetKey( string profile, string key )
+ std::string ProfileGetKey( std::string profile, std::string key )
throw( db_action_failed );
- void ProfileSetKey( string profile, string key, string value )
+ void ProfileSetKey( std::string profile, std::string key, std::string value )
throw( db_action_failed );
- string ProfileGetScript( string profile, string script_name )
+ std::string ProfileGetScript( std::string profile, std::string script_name )
throw( db_action_failed );
- void ProfileSetScript( string profile, string script_name, string script_location )
+ void ProfileSetScript( std::string profile, std::string script_name, std::string script_location )
throw( db_action_failed );
- vector<string> ProfileGetResourceTypes( string profile )
+ std::vector<std::string> ProfileGetResourceTypes( std::string profile )
throw( db_action_failed );
- vector<string> ProfileGetResources( string profile, string resource_type )
+ std::vector<std::string> ProfileGetResources( std::string profile, std::string resource_type )
throw( db_action_failed );
// generic access functions
- void Dump( ostream &output, string key="root" )
+ void Dump( std::ostream &output, std::string key="root" )
throw( db_action_failed );
- void DumpTree( SCDBNode<backend_node> &node, ostream &output );
- void SetValue( string key, string value )
+ void DumpTree( SCDBNode<backend_node> &node, std::ostream &output );
+ void SetValue( std::string key, std::string value )
throw( db_action_failed );
- string GetValue( string key )
+ std::string GetValue( std::string key )
throw( db_action_failed );
- void AddNodes( string key, string value="" ) throw( db_action_failed );
- void DeleteNodes( string key ) throw( db_action_failed );
- void RenameNodes( string key, string name ) throw( db_action_failed );
+ void AddNodes( std::string key, std::string value="" ) throw( db_action_failed );
+ void DeleteNodes( std::string key ) throw( db_action_failed );
+ void RenameNodes( std::string key, std::string name ) throw( db_action_failed );
// SCDB file interface helpers
struct no_such_file{};
struct file_exists{};
- bool FileExists( const string &profile, const string &resource_type,
- const string &resource_name )
+ bool FileExists( const std::string &profile, const std::string &resource_type,
+ const std::string &resource_name )
throw( db_action_failed );
- void FileSave( const string &profile, const string &resource_type,
- const string &resource_name, istream &in, struct stat *st=NULL)
+ void FileSave( const std::string &profile, const std::string &resource_type,
+ const std::string &resource_name, std::istream &in, struct stat *st=NULL)
throw( db_action_failed );
- void FileRestore( const string &profile, const string &resource_type,
- const string &resource_name, ostream &out,
+ void FileRestore( const std::string &profile, const std::string &resource_type,
+ const std::string &resource_name, std::ostream &out,
struct stat *st=NULL )
throw( db_action_failed, no_such_file );
- void FileCopy( const string &profile, const string &dest_profile, const string &resource_type,
- const string &resource_name )
+ void FileCopy( const std::string &profile, const std::string &dest_profile, const std::string &resource_type,
+ const std::string &resource_name )
throw( db_action_failed, no_such_file, file_exists );
- void FileDelete( const string &profile, const string &resource_type,
- const string &resource_name )
+ void FileDelete( const std::string &profile, const std::string &resource_type,
+ const std::string &resource_name )
throw( db_action_failed, no_such_file );
- string &FileGetMD5( const string &profile, const string &resource_type,
- const string &resource_name )
+ std::string &FileGetMD5( const std::string &profile, const std::string &resource_type,
+ const std::string &resource_name )
throw( db_action_failed, no_such_file );
- SCDBFile *FileGetHandle( const string &profile, const string &resource_type,
- const string &resource_name, bool create=true )
+ SCDBFile *FileGetHandle( const std::string &profile, const std::string &resource_type,
+ const std::string &resource_name, bool create=true )
throw( db_action_failed, no_such_file );
- void FileGetBackupVersions( const string &profile, const string &resource_type,
- const string &resource_name, vector<pair<time_t, string> > &versions)
+ void FileGetBackupVersions( const std::string &profile, const std::string &resource_type,
+ const std::string &resource_name, std::vector<std::pair<time_t, std::string> > &versions)
throw( db_action_failed, no_such_file);
- SCDBFile *FileGetBackupHandle( const string &profile, const string &resource_type,
- const string &resource_name, bool create=true, string * version=NULL )
+ SCDBFile *FileGetBackupHandle( const std::string &profile, const std::string &resource_type,
+ const std::string &resource_name, bool create=true, std::string * version=NULL )
throw( db_action_failed, no_such_file );
- SCDBFile *FilePushBackup( const string &profile, const string &resource_type,
- const string &resource_name, bool remove_file = false )
+ SCDBFile *FilePushBackup( const std::string &profile, const std::string &resource_type,
+ const std::string &resource_name, bool remove_file = false )
throw( db_action_failed, no_such_file );
- bool FileRemoveBackup( const string &profile, const string &resource_type,
- const string &resource_name, const string * version2remove=NULL )
+ bool FileRemoveBackup( const std::string &profile, const std::string &resource_type,
+ const std::string &resource_name, const std::string * version2remove=NULL )
throw( db_action_failed, no_such_file );
- SCDBFile *FilePopBackup( const string &profile, const string &resource_type,
- const string &resource_name, const string * version2restore=NULL )
+ SCDBFile *FilePopBackup( const std::string &profile, const std::string &resource_type,
+ const std::string &resource_name, const std::string * version2restore=NULL )
throw( db_action_failed, no_such_file );
- bool FileHasBackup( const string &profile, const string &resource_type,
- const string &resource_name );
+ bool FileHasBackup( const std::string &profile, const std::string &resource_type,
+ const std::string &resource_name );
private:
SCDB( );
@@ -212,20 +210,20 @@ private:
struct not_found{};
struct not_unique{};
- SCDBNode<backend_node> & GetNode( string key ) throw( not_found, not_unique );
- void SearchNodes( SCDBNode<backend_node> &node, string tagspec,
- vector<SCDBNode<backend_node>*> &node_container)
+ SCDBNode<backend_node> & GetNode( std::string key ) throw( not_found, not_unique );
+ void SearchNodes( SCDBNode<backend_node> &node, std::string tagspec,
+ std::vector<SCDBNode<backend_node>*> &node_container)
throw ( not_found );
- bool KeyExists( string key );
- SCDBNode<backend_node> &AddNode( string key, string node_name )
+ bool KeyExists( std::string key );
+ SCDBNode<backend_node> &AddNode( std::string key, std::string node_name )
throw( not_found, not_unique );
- SCDBNode<backend_node> &AddNode( SCDBNode<backend_node> &parent, string node_name );
+ SCDBNode<backend_node> &AddNode( SCDBNode<backend_node> &parent, std::string node_name );
void CopyNode( SCDBNode<backend_node> &src, SCDBNode<backend_node> &dest );
- void CreateSubTree( string rootspec, istream &inputstream ) throw( db_action_failed );
+ void CreateSubTree( std::string rootspec, std::istream &inputstream ) throw( db_action_failed );
bool modified;
XML *backend;
backend_node *root;
- ifstream *db;
+ std::ifstream *db;
};
#endif
Index: src/scdb/scdb_file.hh
===================================================================
--- src/scdb/scdb_file.hh.orig 2012-07-04 17:43:16.922373756 +0200
+++ src/scdb/scdb_file.hh 2012-07-04 17:43:59.445350553 +0200
@@ -25,11 +25,9 @@
#include "scdb_node.hh"
#include "xml.hh"
-using namespace std;
-
static inline std::string itoa( int i )
{
- ostringstream o;
+ std::ostringstream o;
o << i;
return o.str();
}
@@ -44,29 +42,29 @@ public:
struct write_error{ };
struct index_invalid{ };
- string &MD5sum( ) { return md5sum; };
- virtual string &RealMD5sum( ) =0;
- virtual void SetMD5sum( const string &md5 ) { md5sum=md5; scdb_modified=true; };
- virtual void Save( istream &ins, bool auto_md5=false, string suffix="" ) throw( write_error ) =0;
- virtual void Restore( ostream &outs ) throw( read_error, write_error ) =0;
+ std::string &MD5sum( ) { return md5sum; };
+ virtual std::string &RealMD5sum( ) =0;
+ virtual void SetMD5sum( const std::string &md5 ) { md5sum=md5; scdb_modified=true; };
+ virtual void Save( std::istream &ins, bool auto_md5=false, std::string suffix="" ) throw( write_error ) =0;
+ virtual void Restore( std::ostream &outs ) throw( read_error, write_error ) =0;
virtual void Remove( ) throw( write_error ) =0;
- virtual void Create( string suffix ) throw( write_error ) =0;
+ virtual void Create( std::string suffix ) throw( write_error ) =0;
virtual void SaveAttribs( struct stat &attribs ) throw( write_error ) =0;
virtual struct stat &GetAttribs( ) throw( read_error ) =0;
- virtual istream *GetStream( ) throw( read_error ) =0;
- virtual string GetBackupVersion() = 0;
- string &GetName( ) { return name; };
- string &GetType( ) { return type; };
- void SetSubtype( const string &stype ) { subtype=stype; scdb_modified=true; };
- string &GetSubtype( ) { return subtype; };
+ virtual std::istream *GetStream( ) throw( read_error ) =0;
+ virtual std::string GetBackupVersion() = 0;
+ std::string &GetName( ) { return name; };
+ std::string &GetType( ) { return type; };
+ void SetSubtype( const std::string &stype ) { subtype=stype; scdb_modified=true; };
+ std::string &GetSubtype( ) { return subtype; };
unsigned int GetNumContents( ) { return contents.size(); };
- pair<string, string> &GetContent( unsigned int idx ) throw( index_invalid ) {
+ std::pair<std::string, std::string> &GetContent( unsigned int idx ) throw( index_invalid ) {
if (idx>=contents.size()) throw index_invalid();
return contents[idx]; };
- pair<string, string> &operator[]( unsigned int idx ) throw( index_invalid )
+ std::pair<std::string, std::string> &operator[]( unsigned int idx ) throw( index_invalid )
{ return this->GetContent(idx); };
void ClearContent( ) { contents.clear(); scdb_modified=true; };
- void AddContent( pair<string,string> &data ) {
+ void AddContent( std::pair<std::string,std::string> &data ) {
contents.push_back( data );
scdb_modified=true;
};
@@ -74,7 +72,7 @@ public:
int GetStopPriority( ) { return stop_prio; };
void SetStartPriority( int prio ) { start_prio=prio; scdb_modified=true; };
void SetStopPriority( int prio ) { stop_prio=prio; scdb_modified=true; };
- string GetLocation( ) { return read_location; };
+ std::string GetLocation( ) { return read_location; };
virtual ~SCDBFile( ) {
for ( unsigned int i=0; i<scdb_node.GetNumSub(); i++ ) {
if (scdb_node[i].GetName() == "subtype") scdb_node[i].SetValue( subtype );
@@ -98,24 +96,24 @@ public:
private:
SCDBNode<backend_node> &scdb_node;
- list<SCDBNode<backend_node>*> subnodes;
- vector<pair<string, string> > contents;
+ std::list<SCDBNode<backend_node>*> subnodes;
+ std::vector<std::pair<std::string, std::string> > contents;
protected:
- string name;
- string type;
- string subtype;
- string profile;
+ std::string name;
+ std::string type;
+ std::string subtype;
+ std::string profile;
bool &scdb_modified;
- string read_location;
- string write_location;
- string md5sum;
+ std::string read_location;
+ std::string write_location;
+ std::string md5sum;
bool backup;
int start_prio;
int stop_prio;
- vector<SCDBNode<backend_node> *> backup_nodes;
- SCDBFile( SCDBNode<backend_node> &node, const string &resname, const string &restype,
- const string &profile_name, bool &modified, bool is_backup=false )
+ std::vector<SCDBNode<backend_node> *> backup_nodes;
+ SCDBFile( SCDBNode<backend_node> &node, const std::string &resname, const std::string &restype,
+ const std::string &profile_name, bool &modified, bool is_backup=false )
: scdb_node( node ), name( resname ), type( restype ), profile( profile_name ),
scdb_modified( modified ), backup( is_backup ), start_prio(-1), stop_prio(-1) {
for ( unsigned int i=0; i<scdb_node.GetNumSub(); i++ ) {
Index: src/scdb/scdb_node.hh
===================================================================
--- src/scdb/scdb_node.hh.orig 2012-07-04 17:43:16.922373756 +0200
+++ src/scdb/scdb_node.hh 2012-07-04 17:43:59.445350553 +0200
@@ -17,15 +17,13 @@
#ifndef SCDB_NODE_H
#define SCDB_NODE_H
-using namespace std;
-
#include <string>
#include <vector>
template<class Node> class SCDBNode
{
public:
- SCDBNode( string name ) { node_name = name; deleted=false; available=true; };
+ SCDBNode( std::string name ) { node_name = name; deleted=false; available=true; };
virtual ~SCDBNode( ) {};
struct no_such_node {};
@@ -34,7 +32,7 @@ public:
virtual void DelSub( unsigned int idx ) throw( no_such_node )
{
if ( idx>=sub_nodes.size() ) throw no_such_node();
- typename vector<Node*>::iterator i = sub_nodes.begin();
+ typename std::vector<Node*>::iterator i = sub_nodes.begin();
while ( idx-- ) i++;
sub_nodes.erase( i );
};
@@ -45,19 +43,19 @@ public:
return *sub_nodes[idx];
};
- string GetName( ) { return node_name; };
- void SetName( string name ) { node_name = name; };
- void SetValue( string value ) { node_value = value; };
- string GetValue( ) { return node_value; };
+ std::string GetName( ) { return node_name; };
+ void SetName( std::string name ) { node_name = name; };
+ void SetValue( std::string value ) { node_value = value; };
+ std::string GetValue( ) { return node_value; };
void SetDeleted( bool del ) { deleted = del; };
bool Deleted( ) { return deleted; };
bool Available( ) { return available; };
protected:
- string node_name;
- vector<Node*> sub_nodes;
- string node_value;
+ std::string node_name;
+ std::vector<Node*> sub_nodes;
+ std::string node_value;
bool deleted;
bool available;
Index: src/scdb/xml.hh
===================================================================
--- src/scdb/xml.hh.orig 2012-07-04 17:43:16.922373756 +0200
+++ src/scdb/xml.hh 2012-07-04 17:43:59.445350553 +0200
@@ -17,8 +17,6 @@
#ifndef XML_H
#define XML_H
-using namespace std;
-
#include "scdb_node.hh"
#include <iostream>
#include <log.hh>
@@ -39,13 +37,13 @@ public:
//};
private:
- XMLNode( string name ) : SCDBNode<XMLNode>( name ) {};
+ XMLNode( std::string name ) : SCDBNode<XMLNode>( name ) {};
~XMLNode( ) {
unsigned int num = sub_nodes.size();
for ( unsigned int i=0; i<num; i++) delete sub_nodes[i];
};
- streampos filepos;
+ std::streampos filepos;
};
class XML
@@ -63,18 +61,18 @@ public:
struct op_failed{};
XMLNode *GetRoot( ) { return root; };
- string GetSCDBVersion( ) { return scdb_version_str; };
- void SetSCDBVersion( string version ) { scdb_version_str = version; };
- string GetFormatVersion( ) { return format_version_str; };
+ std::string GetSCDBVersion( ) { return scdb_version_str; };
+ void SetSCDBVersion( std::string version ) { scdb_version_str = version; };
+ std::string GetFormatVersion( ) { return format_version_str; };
bool UpToDate( );
// quick=true skips loading of resource and profile data
- bool Load( istream &input, bool quick=false ) throw( );
- void Save( ostream &output );
- void DumpTree( XMLNode &node, ostream &output );
+ bool Load( std::istream &input, bool quick=false ) throw( );
+ void Save( std::ostream &output );
+ void DumpTree( XMLNode &node, std::ostream &output );
void LoadBranch( XMLNode &node ) throw( op_failed );
- XMLNode &AddNode( XMLNode &node, string node_name );
- void CreateSubTree( XMLNode &node, istream &input, bool quick ) throw( op_failed );
+ XMLNode &AddNode( XMLNode &node, std::string node_name );
+ void CreateSubTree( XMLNode &node, std::istream &input, bool quick ) throw( op_failed );
private:
@@ -82,33 +80,33 @@ private:
struct syntax_error
{
public:
- syntax_error( string k, string e, unsigned int l )
+ syntax_error( std::string k, std::string e, unsigned int l )
{
key=k; error=e; line=l;
}
- string key;
- string error;
+ std::string key;
+ std::string error;
unsigned int line;
};
struct end_of_tokens {};
struct key_t {
- string str;
+ std::string str;
bool is_begin_token;
bool is_end_token;
- streampos fpos;
+ std::streampos fpos;
} ;
XMLNode *root;
int node_count;
long tree_size;
- string scdb_version_str;
- string format_version_str;
+ std::string scdb_version_str;
+ std::string format_version_str;
db_stats_t db_stats;
- istream *dbistream;
+ std::istream *dbistream;
- key_t GetKey( istream &input ) throw( syntax_error, end_of_tokens );
+ key_t GetKey( std::istream &input ) throw( syntax_error, end_of_tokens );
};
Index: src/main/scpm.hh
===================================================================
--- src/main/scpm.hh.orig 2012-07-04 17:43:16.922373756 +0200
+++ src/main/scpm.hh 2012-07-04 17:43:59.445350553 +0200
@@ -30,7 +30,7 @@ class SCPM
{
public:
- SCPM( int options=0, std::ostream &info_out=cout, std::ostream &hash_out=cout, std::string root="" );
+ SCPM( int options=0, std::ostream &info_out=std::cout, std::ostream &hash_out=std::cout, std::string root="" );
~SCPM();
bool Enable( bool force=false );
@@ -54,7 +54,7 @@ public:
bool Status( scpm_status_t &status );
bool ShowChanges( std::ostream &output, std::string resource_type,
- std::string resource_name, bool backup=false, string version="" );
+ std::string resource_name, bool backup=false, std::string version="" );
bool SetResourceSet( std::string set );
bool GetResourceSet( std::string &set );
@@ -84,12 +84,15 @@ public:
bool GetConfigOption( const std::string &option, std::string &value );
// update and backup functions
- bool Update( const std::string &scriptname, std::vector<pair<std::string, std::string> > resources );
+ bool Update( const std::string &scriptname, std::vector<std::pair<std::string, std::string> > resources );
bool UpdateResources( );
- bool RestoreBackup( const std::vector<pair<string, string> > &resources, const std::vector<std::string> &versions, const std::string &profile );
- bool RemoveBackup( const std::vector<pair<string, string> > &resources, const std::vector<std::string> &versions, const std::string &profile );
+ bool RestoreBackup( const std::vector<std::pair<std::string, std::string> > &resources,
+ const std::vector<std::string> &versions, const std::string &profile );
+ bool RemoveBackup( const std::vector<std::pair<std::string, std::string> > &resources,
+ const std::vector<std::string> &versions, const std::string &profile );
bool ListBackups( const std::string &profile, std::vector<backup_info_t> *reslist );
- bool AddBackup( const std::vector<pair<string, string> > &resources, const std::string &profile);
+ bool AddBackup( const std::vector<std::pair<std::string, std::string> > &resources,
+ const std::string &profile);
bool Recover( bool rollback=false );
bool Commit( );
@@ -98,7 +101,8 @@ private:
struct prepare_failed{};
- std::vector<resource_group_t> &GetGroupsByResource( const std::string &resname, const std::string &restype );
+ std::vector<resource_group_t> &GetGroupsByResource( const std::string &resname,
+ const std::string &restype );
void Prepare( bool write_access=false );
SCPM_helpers *sh;
Index: src/scdb/local_file.hh
===================================================================
--- src/scdb/local_file.hh.orig 2012-07-04 17:43:16.922373756 +0200
+++ src/scdb/local_file.hh 2012-07-04 17:43:59.445350553 +0200
@@ -27,24 +27,24 @@ public:
friend class SCDB;
friend class SCDBUtil;
- void Save( istream &ins, bool auto_md5=false, string suffix="") throw( SCDBFile::write_error );
- void Restore( ostream &outs ) throw( SCDBFile::read_error, SCDBFile::write_error );
+ void Save( std::istream &ins, bool auto_md5=false, std::string suffix="") throw( SCDBFile::write_error );
+ void Restore( std::ostream &outs ) throw( SCDBFile::read_error, SCDBFile::write_error );
void Remove( ) throw( SCDBFile::write_error );
- void Create( string suffix="" ) throw( SCDBFile::write_error );
+ void Create( std::string suffix="" ) throw( SCDBFile::write_error );
void SaveAttribs( struct stat &attribs ) throw( SCDBFile::write_error );
struct stat &GetAttribs( ) throw( SCDBFile::read_error );
- istream *GetStream( ) throw( SCDBFile::read_error );
- string &RealMD5sum( );
- string GetBackupVersion();
+ std::istream *GetStream( ) throw( SCDBFile::read_error );
+ std::string &RealMD5sum( );
+ std::string GetBackupVersion();
private:
- LocalFile( SCDBNode<backend_node> &node, const string &resname, const string &restype,
- const string &profile_name, bool &modified, bool is_backup=false );
- string &EncodeFilename( string &s );
- void GenerateWriteLocation(string suffix="" ) throw( SCDBFile::write_error );
- string GetSuffix( string &fname, string suffix="" );
- void WriteBackupInfo( string &fname ) throw( SCDBFile::write_error );
- void ReadBackupInfo( string &fname ) throw( SCDBFile::read_error );
+ LocalFile( SCDBNode<backend_node> &node, const std::string &resname, const std::string &restype,
+ const std::string &profile_name, bool &modified, bool is_backup=false );
+ std::string &EncodeFilename( std::string &s );
+ void GenerateWriteLocation(std::string suffix="" ) throw( SCDBFile::write_error );
+ std::string GetSuffix( std::string &fname, std::string suffix="" );
+ void WriteBackupInfo( std::string &fname ) throw( SCDBFile::write_error );
+ void ReadBackupInfo( std::string &fname ) throw( SCDBFile::read_error );
};
Index: include/tokenizer.h
===================================================================
--- include/tokenizer.h.orig 2012-07-04 17:43:16.921373780 +0200
+++ include/tokenizer.h 2012-07-04 17:43:59.445350553 +0200
@@ -31,8 +31,8 @@ public:
struct end_of_tokens{};
Tokenizer( const char *str, const char *delim=" " ) { s = strdup(str); d=delim; i=0; };
~Tokenizer() { free( s ); };
- string &GetToken() throw( end_of_tokens ) {
- static string tok;
+ std::string &GetToken() throw( end_of_tokens ) {
+ static std::string tok;
tok="";
while ( is_in( s[i], d) ) i++;
if ( s[i] == '\0' ) throw end_of_tokens();
Index: src/main/scpm.cc
===================================================================
--- src/main/scpm.cc.orig 2012-07-04 17:43:16.922373756 +0200
+++ src/main/scpm.cc 2012-07-04 17:43:59.445350553 +0200
@@ -32,6 +32,9 @@
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
+
+using namespace std;
+
#define _(x) dgettext ("scpm", x)
#define module_name "scpm"
Index: src/modules/file.hh
===================================================================
--- src/modules/file.hh.orig 2012-07-04 17:43:16.922373756 +0200
+++ src/modules/file.hh 2012-07-04 17:43:59.446350529 +0200
@@ -30,7 +30,7 @@ public:
friend class Resource_helpers;
- string GetType( ) { return "file"; };
+ std::string GetType( ) { return "file"; };
// some compilers (at least gcc 3) may argue about overriding throw statements
// so we add them here as dummies (will not be thrown here)
@@ -40,44 +40,44 @@ public:
bool NeedsUpdate( ) throw( Resource::not_available ) ;
bool Save( ) throw( Resource::not_available );
bool Restore( ) throw( Resource::not_available );
- bool Patch( const string &ref_profile ) throw( Resource::not_available );
+ bool Patch( const std::string &ref_profile ) throw( Resource::not_available );
void UpdateData( ) throw( Resource::not_available );
- vector<string> GetDependencies( ) throw( Resource::not_available ) { vector<string> v; return v; };
- void ShowChanges( ostream &ouput, bool backup, string version="" ) throw( Resource::not_available );
- bool ModifiedInProfile( const string &destprofile ) throw( Resource::not_available );
+ std::vector<std::string> GetDependencies( ) throw( Resource::not_available ) { std::vector<std::string> v; return v; };
+ void ShowChanges( std::ostream &ouput, bool backup, std::string version="" ) throw( Resource::not_available );
+ bool ModifiedInProfile( const std::string &destprofile ) throw( Resource::not_available );
bool AddBackup( ) throw( Resource::not_available );
bool HasSystemAlternative( ) throw( Resource::not_available );
bool HasSystemBackup( ) throw( Resource::not_available );
bool HasBackup( ) throw( Resource::not_available );
- bool RestoreBackup( const string * version = NULL ) throw( Resource::not_available );
- bool RemoveBackup( const string * version = NULL) throw( Resource::not_available );
- vector< pair<time_t, string> > GetBackupVersions( ) throw( Resource::not_available );
- bool Export( const string &root ) throw( Resource::not_available );
- bool Import( const string &root ) throw( Resource::not_available );
+ bool RestoreBackup( const std::string * version = NULL ) throw( Resource::not_available );
+ bool RemoveBackup( const std::string * version = NULL) throw( Resource::not_available );
+ std::vector< std::pair<time_t, std::string> > GetBackupVersions( ) throw( Resource::not_available );
+ bool Export( const std::string &root ) throw( Resource::not_available );
+ bool Import( const std::string &root ) throw( Resource::not_available );
bool Refresh( ) throw( Resource::not_available );
void PushBackup( ) throw( Resource::not_available );
- void SetRoot( const string &path) throw( Resource::not_available );
+ void SetRoot( const std::string &path) throw( Resource::not_available );
private:
- File( string name_string, string type_string, bool allow_missing );
+ File( std::string name_string, std::string type_string, bool allow_missing );
~File( );
Log *log;
- string postrestore;
- vector<string> files;
- static string type;
+ std::string postrestore;
+ std::vector<std::string> files;
+ static std::string type;
bool is_directory;
int backup_state;
- string ReadLink( const string &link );
- void SaveFile( const string &file, SCDBFile *f, string suffix="" ) throw( SCDBFile::write_error );
+ std::string ReadLink( const std::string &link );
+ void SaveFile( const std::string &file, SCDBFile *f, std::string suffix="" ) throw( SCDBFile::write_error );
bool RestoreFile( SCDBFile *f );
void ResolveFiles( );
- string GetType( const string &file );
+ std::string GetType( const std::string &file );
bool FileModified( SCDBFile *fileh );
- void CreatePath( const string &path );
+ void CreatePath( const std::string &path );
};
Index: src/modules/service.hh
===================================================================
--- src/modules/service.hh.orig 2012-07-04 17:43:16.922373756 +0200
+++ src/modules/service.hh 2012-07-04 17:43:59.446350529 +0200
@@ -29,7 +29,7 @@ public:
friend class Resource_helpers;
- string GetType( ) { return "service"; };
+ std::string GetType( ) { return "service"; };
// some compilers (at least gcc 3) may argue about overriding throw statements
// so we add them here as dummies (will not be thrown here)
@@ -42,40 +42,40 @@ public:
bool Restart( ) throw( Resource::not_available );
bool Save( ) throw( Resource::not_available );
bool Restore( ) throw( Resource::not_available );
- vector<string> GetDependencies( string resource_type ) throw( Resource::not_available );
+ std::vector<std::string> GetDependencies( std::string resource_type ) throw( Resource::not_available );
int GetStartPriority( ) throw( Resource::not_available );
int GetStopPriority( ) throw( Resource::not_available );
void UpdateData( ) throw( Resource::not_available );
bool Refresh( ) throw( Resource::not_available );
bool HasBackup( ) throw( Resource::not_available );
bool AddBackup( ) throw( Resource::not_available );
- bool RestoreBackup( const string* version=NULL ) throw( Resource::not_available );
- bool RemoveBackup( const string * version = NULL) throw( Resource::not_available );
- vector< pair<time_t, string> > GetBackupVersions( ) throw( Resource::not_available );
- void ShowChanges( ostream &output, bool backup=false, string version="" ) throw( Resource::not_available );
- bool Export( const string &root ) throw( Resource::not_available );
- bool Import( const string &root ) throw( Resource::not_available );
+ bool RestoreBackup( const std::string* version=NULL ) throw( Resource::not_available );
+ bool RemoveBackup( const std::string * version = NULL) throw( Resource::not_available );
+ std::vector< std::pair<time_t, std::string> > GetBackupVersions( ) throw( Resource::not_available );
+ void ShowChanges( std::ostream &output, bool backup=false, std::string version="" ) throw( Resource::not_available );
+ bool Export( const std::string &root ) throw( Resource::not_available );
+ bool Import( const std::string &root ) throw( Resource::not_available );
private:
- Service( string name_string, string type_string, bool allow_missing );
+ Service( std::string name_string, std::string type_string, bool allow_missing );
~Service( );
- static const string init_dir;
- vector<string> provides;
- string start_link;
- string stop_link;
+ static const std::string init_dir;
+ std::vector<std::string> provides;
+ std::string start_link;
+ std::string stop_link;
Log *log;
struct link_not_found {};
- string ReadLink( string link );
+ std::string ReadLink( std::string link );
void RemoveLinks( );
- void CreateLink( string link );
- string GetStartLink( string directory );
- string GetStopLink( string directory );
+ void CreateLink( std::string link );
+ std::string GetStartLink( std::string directory );
+ std::string GetStopLink( std::string directory );
char GetRunlevel( );
- void DetermineInitDirs( vector<string> &rc_dirs );
+ void DetermineInitDirs( std::vector<std::string> &rc_dirs );
int CalcStartPriority( );
int CalcStopPriority( );
};
Index: src/modules/sysconfig.hh
===================================================================
--- src/modules/sysconfig.hh.orig 2012-07-04 17:43:16.922373756 +0200
+++ src/modules/sysconfig.hh 2012-07-04 17:43:59.446350529 +0200
@@ -27,7 +27,7 @@ public:
friend class Resource_helpers;
- string GetType( ) { return "service"; };
+ std::string GetType( ) { return "service"; };
// some compilers (at least gcc 3) may argue about overriding throw statements
// so we add them here as dummies (will not be thrown here)
@@ -40,7 +40,7 @@ public:
private:
- SYSConfig( string name_string, string type_string );
+ SYSConfig( std::string name_string, std::string type_string );
~SYSConfig( );
Log *log;
Index: src/scdb/scdb_util.hh
===================================================================
--- src/scdb/scdb_util.hh.orig 2012-07-04 17:43:16.922373756 +0200
+++ src/scdb/scdb_util.hh 2012-07-04 17:43:59.446350529 +0200
@@ -29,7 +29,7 @@ public:
struct operation_failed
{
public:
- operation_failed( string r ) { reason = r; };
+ operation_failed( std::string r ) { reason = r; };
std::string reason;
};
@@ -54,10 +54,10 @@ public:
throw( operation_failed );
// release a bind resource from one or all profiles
void ReleaseResource( std::string resource_name, std::string resource_type,
- string profile="all" )
+ std::string profile="all" )
throw( operation_failed );
// checks for resources which are the same in ALL profiles
- void FindUnusedResources( vector<string> &resource_names, vector<std::string> &resource_types )
+ void FindUnusedResources( std::vector<std::string> &resource_names, std::vector<std::string> &resource_types )
throw( operation_failed );
// checks for resources which exist but are not in db
void FindUnhandledResources( std::vector<std::string> &resource_names,
@@ -78,8 +78,8 @@ public:
//void RebuildData( ) throw( operation_failed );
void FindUnreferencedFiles( std::vector<std::string> &filenames ) throw( operation_failed );
- void ExportProfile( const string &root, const string &profile ) throw( operation_failed );
- void ImportProfile( const string &root, const string &profile ) throw( operation_failed );
+ void ExportProfile( const std::string &root, const std::string &profile ) throw( operation_failed );
+ void ImportProfile( const std::string &root, const std::string &profile ) throw( operation_failed );
private:
SCDB *db;
Index: src/cli/cli.cc
===================================================================
--- src/cli/cli.cc.orig 2012-07-04 17:43:16.921373780 +0200
+++ src/cli/cli.cc 2012-07-04 17:43:59.446350529 +0200
@@ -23,8 +23,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-using namespace std;
-
#include <stdio.h>
#include "globals.h"
#include "help_texts.h"
@@ -45,6 +43,9 @@ using namespace std;
#include <signal.h>
#include <algorithm>
+using namespace std;
+
+
int options = 0;
int command;
string cmd_prompt = "> ";
Index: src/cli/db_commands.cc
===================================================================
--- src/cli/db_commands.cc.orig 2012-07-04 17:43:16.921373780 +0200
+++ src/cli/db_commands.cc 2012-07-04 17:43:59.446350529 +0200
@@ -26,6 +26,8 @@
#include <fstream>
#include <libintl.h>
+using namespace std;
+
bool check_if_valid_arg( string arg, string type )
{
if ( type == "resource" ) {
Index: src/main/executor.cc
===================================================================
--- src/main/executor.cc.orig 2012-07-04 17:43:16.922373756 +0200
+++ src/main/executor.cc 2012-07-04 17:43:59.446350529 +0200
@@ -32,6 +32,8 @@
#include <dirent.h>
#include <sys/stat.h>
+using namespace std;
+
#define module_name "executor"
Executor::Executor( string command )
Index: src/main/journal.cc
===================================================================
--- src/main/journal.cc.orig 2012-07-04 17:43:16.922373756 +0200
+++ src/main/journal.cc 2012-07-04 17:43:59.446350529 +0200
@@ -25,6 +25,8 @@
#include <iostream>
+using namespace std;
+
#define module_name "journal"
static inline std::string itoa( int i )
Index: src/main/modlib.cc
===================================================================
--- src/main/modlib.cc.orig 2012-07-04 17:43:16.922373756 +0200
+++ src/main/modlib.cc 2012-07-04 17:43:59.447350505 +0200
@@ -28,6 +28,8 @@
#include <sys/stat.h>
#include <unistd.h>
+using namespace std;
+
#define module_name "modlib"
string Modlib::GetMD5sum( string filename )
Index: src/main/profile.cc
===================================================================
--- src/main/profile.cc.orig 2012-07-04 17:43:16.922373756 +0200
+++ src/main/profile.cc 2012-07-04 17:43:59.447350505 +0200
@@ -31,6 +31,8 @@
#include <dirent.h>
#include <sstream>
+using namespace std;
+
Profile::Profile( string profile_name )
: module_name( "profile" )
{
Index: src/main/progress.cc
===================================================================
--- src/main/progress.cc.orig 2012-07-04 17:43:16.922373756 +0200
+++ src/main/progress.cc 2012-07-04 17:43:59.447350505 +0200
@@ -19,6 +19,8 @@
#include "log.hh"
#include <string.h>
+using namespace std;
+
Progress::Progress( ostream &info_out, ostream &hash_out )
: output_info(info_out), output_hash(hash_out)
{
Index: src/main/resource.cc
===================================================================
--- src/main/resource.cc.orig 2012-07-04 17:43:16.922373756 +0200
+++ src/main/resource.cc 2012-07-04 17:43:59.447350505 +0200
@@ -19,6 +19,8 @@
#include "scdb.hh"
#include "journal.hh"
+using namespace std;
+
#define module_name "resource"
Resource::Resource( string name_string, string type_string, bool allow_missing ) throw( resource_unknown ) :
Index: src/main/resource_helpers.cc
===================================================================
--- src/main/resource_helpers.cc.orig 2012-07-04 17:43:16.922373756 +0200
+++ src/main/resource_helpers.cc 2012-07-04 17:43:59.447350505 +0200
@@ -23,6 +23,8 @@
#include <file_old.hh>
#include <service_old.hh>
+using namespace std;
+
#define module_name "resource_helpers"
Resource_helpers::~Resource_helpers( )
Index: src/main/scpm_conf.cc
===================================================================
--- src/main/scpm_conf.cc.orig 2012-07-04 17:43:16.922373756 +0200
+++ src/main/scpm_conf.cc 2012-07-04 17:43:59.447350505 +0200
@@ -23,6 +23,8 @@
#include <unistd.h>
#include <stdlib.h>
+using namespace std;
+
SCPM_conf::SCPM_conf( )
{
struct stat buf;
Index: src/main/scpm_helpers.cc
===================================================================
--- src/main/scpm_helpers.cc.orig 2012-07-04 17:43:16.922373756 +0200
+++ src/main/scpm_helpers.cc 2012-07-04 17:43:59.448350481 +0200
@@ -35,6 +35,8 @@
#include <dirent.h>
#include <errno.h>
+using namespace std;
+
#define module_name "scpm_helpers"
int scpm_journal_abort_steps = -1;
Index: src/main/storage.cc
===================================================================
--- src/main/storage.cc.orig 2012-07-04 17:43:16.922373756 +0200
+++ src/main/storage.cc 2012-07-04 17:43:59.448350481 +0200
@@ -23,6 +23,8 @@
#include <utime.h>
#include <unistd.h>
+using namespace std;
+
#define module_name "storage"
void Storage::Save( string profile, string category, string name, istream &data )
Index: src/modules/file.cc
===================================================================
--- src/modules/file.cc.orig 2012-07-04 17:43:16.922373756 +0200
+++ src/modules/file.cc 2012-07-04 17:43:59.448350481 +0200
@@ -33,6 +33,8 @@
#include <executor.hh>
#include <cstring>
+using namespace std;
+
#define module_name "file"
string File::type = "file";
Index: src/modules/file_old.cc
===================================================================
--- src/modules/file_old.cc.orig 2012-07-04 17:43:16.922373756 +0200
+++ src/modules/file_old.cc 2012-07-04 17:43:59.448350481 +0200
@@ -26,6 +26,8 @@
#include <errno.h>
#include <modlib.hh>
+using namespace std;
+
#define module_name "file_old"
File_OLD::File_OLD( string name_string, string type_string ) : Resource( name_string, type_string )
Index: src/modules/service.cc
===================================================================
--- src/modules/service.cc.orig 2012-07-04 17:43:16.922373756 +0200
+++ src/modules/service.cc 2012-07-04 17:43:59.448350481 +0200
@@ -32,6 +32,8 @@
#include <stdlib.h>
#include <scdb.hh>
+using namespace std;
+
#define module_name "service"
Service::Service( string name_string, string type_string, bool allow_missing )
Index: src/modules/service_old.cc
===================================================================
--- src/modules/service_old.cc.orig 2012-07-04 17:43:16.922373756 +0200
+++ src/modules/service_old.cc 2012-07-04 17:43:59.448350481 +0200
@@ -31,6 +31,8 @@
#include <unistd.h>
#include <stdlib.h>
+using namespace std;
+
#define module_name "service_old"
Service_OLD::Service_OLD( string name_string, string type_string )
Index: src/modules/sysconfig.cc
===================================================================
--- src/modules/sysconfig.cc.orig 2012-07-04 17:43:16.922373756 +0200
+++ src/modules/sysconfig.cc 2012-07-04 17:43:59.448350481 +0200
@@ -26,6 +26,8 @@
#include <sys/types.h>
#include <sys/stat.h>
+using namespace std;
+
SYSConfig::SYSConfig( string name_string, string type_string )
: Resource( name_string, type_string )
{
Index: src/scdb/local_file.cc
===================================================================
--- src/scdb/local_file.cc.orig 2012-07-04 17:43:16.922373756 +0200
+++ src/scdb/local_file.cc 2012-07-04 17:43:59.449350457 +0200
@@ -28,6 +28,8 @@
#include <utime.h>
#include <cstring>
+using namespace std;
+
#define module_name "local_file"
LocalFile::LocalFile( SCDBNode<backend_node> &node, const string &resname,
Index: src/scdb/scdb.cc
===================================================================
--- src/scdb/scdb.cc.orig 2012-07-04 17:43:16.922373756 +0200
+++ src/scdb/scdb.cc 2012-07-04 17:43:59.449350457 +0200
@@ -25,6 +25,8 @@
#include <utime.h>
#define module_name "scdb"
+using namespace std;
+
SCDB::SCDB( )
{
db = NULL;
Index: src/scdb/scdb_util.cc
===================================================================
--- src/scdb/scdb_util.cc.orig 2012-07-04 17:43:16.922373756 +0200
+++ src/scdb/scdb_util.cc 2012-07-04 17:43:59.449350457 +0200
@@ -26,6 +26,8 @@
#include <string.h>
#include <utime.h>
+using namespace std;
+
const string module_name="scdb_util";
void SCDBUtil::CreateResource( string resource_name, string resource_type,
Index: src/scdb/xml.cc
===================================================================
--- src/scdb/xml.cc.orig 2012-07-04 17:43:16.922373756 +0200
+++ src/scdb/xml.cc 2012-07-04 17:43:59.449350457 +0200
@@ -19,6 +19,8 @@
#include <sstream>
#include <cstring>
+using namespace std;
+
XML::XML( )
{
root = new XMLNode( "root" );
Index: src/modules/file_old.hh
===================================================================
--- src/modules/file_old.hh.orig 2012-07-04 17:43:16.922373756 +0200
+++ src/modules/file_old.hh 2012-07-04 17:43:59.449350457 +0200
@@ -31,7 +31,7 @@ public:
friend class Resource_helpers;
- string GetType( ) { return "file"; };
+ std::string GetType( ) { return "file"; };
// some compilers (at least gcc 3) may argue about overriding throw statements
// so we add them here as dummies (will not be thrown here)
@@ -41,25 +41,25 @@ public:
bool Save( ) throw( Resource::not_available );
bool Restore( ) throw( Resource::not_available );
void UpdateData( ) throw( Resource::not_available );
- vector<string> GetDependencies( ) throw( Resource::not_available ) { vector<string> v; return v; };
- void ShowChanges( ostream &ouput ) throw( Resource::not_available );
+ std::vector<std::string> GetDependencies( ) throw( Resource::not_available ) { std::vector<std::string> v; return v; };
+ void ShowChanges( std::ostream &ouput ) throw( Resource::not_available );
private:
- File_OLD( string name_string, string type_string );
+ File_OLD( std::string name_string, std::string type_string );
~File_OLD( );
Log *log;
- string postrestore;
- vector<string> files;
+ std::string postrestore;
+ std::vector<std::string> files;
bool is_directory;
- string ReadLink( string link );
- void SaveFile( string file );
- void RestoreFile( string file_type, string file );
+ std::string ReadLink( std::string link );
+ void SaveFile( std::string file );
+ void RestoreFile( std::string file_type, std::string file );
void ResolveFiles( );
- string GetType( string file );
+ std::string GetType( std::string file );
};
Index: src/modules/service_old.hh
===================================================================
--- src/modules/service_old.hh.orig 2012-07-04 17:43:16.922373756 +0200
+++ src/modules/service_old.hh 2012-07-04 17:43:59.449350457 +0200
@@ -29,7 +29,7 @@ public:
friend class Resource_helpers;
- string GetType( ) { return "service"; };
+ std::string GetType( ) { return "service"; };
// some compilers (at least gcc 3) may argue about overriding throw statements
// so we add them here as dummies (will not be thrown here)
@@ -42,31 +42,31 @@ public:
bool Restart( ) throw( Resource::not_available );
bool Save( ) throw( Resource::not_available );
bool Restore( ) throw( Resource::not_available );
- vector<string> GetDependencies( string resource_type ) throw( Resource::not_available );
+ std::vector<std::string> GetDependencies( std::string resource_type ) throw( Resource::not_available );
int GetStartPriority( ) throw( Resource::not_available );
int GetStopPriority( ) throw( Resource::not_available );
void UpdateData( ) throw( Resource::not_available );
private:
- Service_OLD( string name_string, string type_string );
+ Service_OLD( std::string name_string, std::string type_string );
~Service_OLD( );
- static const string init_dir;
- vector<string> provides;
- string start_link;
- string stop_link;
+ static const std::string init_dir;
+ std::vector<std::string> provides;
+ std::string start_link;
+ std::string stop_link;
Log *log;
struct link_not_found {};
- string ReadLink( string link );
+ std::string ReadLink( std::string link );
void RemoveLinks( );
- void CreateLink( string link );
- string GetStartLink( string directory );
- string GetStopLink( string directory );
+ void CreateLink( std::string link );
+ std::string GetStartLink( std::string directory );
+ std::string GetStopLink( std::string directory );
char GetRunlevel( );
- void DetermineInitDirs( vector<string> &rc_dirs );
+ void DetermineInitDirs( std::vector<std::string> &rc_dirs );
};