Exemplo n.º 1
0
void Bot::writeToHistoryLog(QString mes_str)
{
    QString fileName_cur = MSG_HISTORY+"."+FILE_FORMAT;
    QString fileName_h = MSG_HISTORY+"_"+QString::number(startTime_m)+"."+FILE_FORMAT;

    writeLineToFile(mes_str, fileName_cur);
    writeLineToFile(mes_str, fileName_h);
}
Exemplo n.º 2
0
bool DataHandler::addProfile(const std::string& profileName)
{
  if (currentFile != pProfiles)
    throw StringException("Profile isn't loaded.");
  for (unsigned int i=0; i < res->size(); i++)
  {
    if ( res->getNode(i)->getString() == profileName )
      throw StringException("That profile already exists.\n");
  }
  return writeLineToFile(profileName, pProfiles, MAX_LINE_IN_FILE);
}
Exemplo n.º 3
0
bool DataHandler::addDatabase(const std::string& databaseString)
{
  if (currentFile != pProfile)
    throw StringException("Profile isn't loaded.");

  ProfileNode pn;

  // Utilize ProfileNode's validator
  if (!pn.setString(databaseString))
    throw StringException("Invalid databaseString.");

  for (unsigned int i=0; i < res->size(); i++)
  {
    // Utilize ProfileNode's parsing of the database name.
    if ( ((ProfileNode*)res->getNode(i))->getDatabase() == pn.getDatabase() )
      throw StringException("That database already exists.\n");
  }

  return writeLineToFile(databaseString, pProfile, MAX_LINE_IN_FILE);
}
Exemplo n.º 4
0
bool DataHandler::writeToDatabase(const std::string& lineInDatabase)
{
  if (currentFile != pDatabase)
    throw StringException("Database isn't loaded.");
  return writeLineToFile(lineInDatabase, pDatabase, MAX_LINE_IN_FILE);
}