Source Code (Use browser search to find items of interest.)
Class Index
kcron'CTHost (./kdeadmin/kcron/cthost.h:35)
class CTHost
{
public:
/**
* Constructs the user(s), scheduled tasks, and environment variables
* from crontab files.
*/
CTHost();
/**
* Destroys the user(s), scheduled tasks, and environment variable
* objects. Does not make any changes to the crontab files. Any unapplied
* changes are consequently "cancelled."
*/
~CTHost();
/**
* Apply changes.
*/
void apply();
/**
* Cancel changes.
*/
void cancel();
/**
* Indicates whether or not dirty.
*/
bool dirty();
/**
* Indicates whether or not the user is the root user.
*/
bool root() const;
/**
* User(s).
*
* If the user is the root user, the cron vector will have a member for
* each user of the host plus one for the system crontab.
*
* If the user is a non-root user, there will be only one member in the
* cron vector.
*/
vector<CTCron*> cron;
private:
/**
* Copy construction not allowed.
*/
CTHost(const CTHost& source);
/**
* Assignment not allowed
*/
void operator = (const CTHost& source);
/**
* Factory create a cron table. Appends to the end of cron.
*/
CTCron* createCTCron(bool _syscron = false, string _login = "");
};
kcron'CTHost::CTHost() (./kdeadmin/kcron/cthost.cpp:23)
CTHost::CTHost()
{
// If it is the root user
if (getuid() == 0)
{
// Create the system cron table.
createCTCron(true);
// Get a user list out of the password file
ifstream inputStream("/etc/passwd");
const int MAX = 1024;
char buffer[MAX];
string line;
string login;
// Create each user's cron table.
while (inputStream)
{
inputStream.getline(buffer, MAX);
line = buffer;
login = line.substr(0,line.find(":"));
if (login != "")
createCTCron(false, login);
}
}
else
// Non-root user, so just create user's cron table.
{
createCTCron();
}
}
kcron'CTHost::~CTHost() (./kdeadmin/kcron/cthost.cpp:56)
CTHost::~CTHost()
{
for (CTCronIterator i = cron.begin(); i != cron.end(); i++)
delete *i;
}
kcron'CTHost::apply() (./kdeadmin/kcron/cthost.cpp:62)
void CTHost::apply()
{
for (CTCronIterator i = cron.begin(); i != cron.end(); i++)
(*i)->apply();
}
kcron'CTHost::cancel() (./kdeadmin/kcron/cthost.cpp:68)
void CTHost::cancel()
{
for (CTCronIterator i = cron.begin(); i != cron.end(); i++)
(*i)->cancel();
}
kcron'CTHost::dirty() (./kdeadmin/kcron/cthost.cpp:74)
bool CTHost::dirty()
{
bool isDirty(false);
for (CTCronIterator i = cron.begin(); i != cron.end(); i++)
if ((*i)->dirty()) isDirty = true;
return isDirty;
}
kcron'CTHost::createCTCron() (./kdeadmin/kcron/cthost.cpp:84)
CTCron* CTHost::createCTCron(bool _syscron, string _login)
{
CTCron *p = new CTCron(_syscron, _login);
cron.push_back(p);
return p;
}
kcron'CTHost::root() (./kdeadmin/kcron/cthost.cpp:91)
bool CTHost::root() const
{
return (!getuid());
}