Ejemplo n.º 1
0
 SfxOptions read_controls() {
   SfxOptions options;
   const SfxModules& sfx_modules = ArcAPI::sfx();
   unsigned sfx_id = get_list_pos(module_ctrl_id);
   if (sfx_id >= sfx_modules.size()) {
     FAIL_MSG(Far::get_msg(MSG_SFX_OPTIONS_DLG_WRONG_MODULE));
   }
   options.name = extract_file_name(sfx_modules[sfx_id].path);
   options.replace_icon = get_check(replace_icon_ctrl_id);
   if (options.replace_icon) {
     options.icon_path = get_text(icon_path_ctrl_id);
     if (!File::exists(options.icon_path)) {
       FAIL_MSG(Far::get_msg(MSG_SFX_OPTIONS_DLG_INVALID_ICON_PATH));
     }
   }
   else
     options.icon_path.clear();
   options.replace_version = get_check(replace_version_ctrl_id);
   if (options.replace_version) {
     options.ver_info.version = get_text(ver_info_version_ctrl_id);
     options.ver_info.comments = get_text(ver_info_comments_ctrl_id);
     options.ver_info.company_name = get_text(ver_info_company_name_ctrl_id);
     options.ver_info.file_description = get_text(ver_info_file_description_ctrl_id);
     options.ver_info.legal_copyright = get_text(ver_info_legal_copyright_ctrl_id);
     options.ver_info.product_name = get_text(ver_info_product_name_ctrl_id);
   }
   else {
     options.ver_info.version.clear();
     options.ver_info.comments.clear();
     options.ver_info.company_name.clear();
     options.ver_info.file_description.clear();
     options.ver_info.legal_copyright.clear();
     options.ver_info.product_name.clear();
   }
   bool install_config_enabled = sfx_modules[sfx_id].install_config();
   options.append_install_config = install_config_enabled && get_check(append_install_config_ctrl_id);
   if (options.append_install_config) {
     options.install_config.title = get_text(install_config_title_ctrl_id);
     options.install_config.begin_prompt = get_text(install_config_begin_prompt_ctrl_id);
     TriState value = get_check3(install_config_progress_ctrl_id);
     if (value == triUndef)
       options.install_config.progress.clear();
     else
       options.install_config.progress = value == triTrue ? L"yes" : L"no";
     options.install_config.run_program = get_text(install_config_run_program_ctrl_id);
     options.install_config.directory = get_text(install_config_directory_ctrl_id);
     options.install_config.execute_file = get_text(install_config_execute_file_ctrl_id);
     options.install_config.execute_parameters = get_text(install_config_execute_parameters_ctrl_id);
   }
   else {
     options.install_config.title.clear();
     options.install_config.begin_prompt.clear();
     options.install_config.progress.clear();
     options.install_config.run_program.clear();
     options.install_config.directory.clear();
     options.install_config.execute_file.clear();
     options.install_config.execute_parameters.clear();
   }
   return options;
 }
  bool OutProgressiveOGG::parseInit(std::string & initData, std::deque<std::string> & output){
    std::string temp;
    unsigned int index = 0;
    if (initData[0] == 0x02){ //"special" case, requires interpretation similar to table
      if (initData.size() < 7){
        FAIL_MSG("initData size too tiny (size: %lu)", initData.size());
        return false;
      }
      unsigned int len1 = 0 ;
      unsigned int len2 = 0 ;
      index = 1;
      while (initData[index] == 255){ //get len 1
        len1 += initData[index++];
      }
      len1 += initData[index++];

      while (initData[index] == 255){ //get len 1
        len2 += initData[index++];
      }
      len2 += initData[index++];

      if (initData.size() < (len1 + len2 + 4)){
        FAIL_MSG("initData size too tiny (size: %lu)", initData.size());
        return false;
      }

      temp = initData.substr(index, len1);
      output.push_back(temp);
      index += len1;
      temp = initData.substr(index, len2);
      output.push_back(temp);
      index += len2;
      temp = initData.substr(index);      //remainder of string:
      output.push_back(temp);             //add data to output deque
    } else {
      if (initData.size() < 7){
        FAIL_MSG("initData size too tiny (size: %lu)", initData.size());
        return false;
      }
      unsigned int len = 0;
      for (unsigned int i = 0; i < 3; i++){
        temp = initData.substr(index, 2);
        len = (((unsigned int)temp[0]) << 8) | (temp[1]); //2 bytes len
        index += 2; //start of data
        if (index + len > initData.size()){
          FAIL_MSG("index+len > initData size");
          return false;
        }
        temp = initData.substr(index, len);
        output.push_back(temp);             //add data to output deque
        index += len;
        INFO_MSG("init data len[%d]: %d ", i, len);
      }
    }

    return true;
  }
Ejemplo n.º 3
0
 void inputFLV::getNext(bool smart) {
   static JSON::Value thisPack;
   static AMF::Object amf_storage;
   thisPack.null();
   long long int lastBytePos = ftell(inFile);
   FLV::Tag tmpTag;
   while (!feof(inFile) && !FLV::Parse_Error){
     if (tmpTag.FileLoader(inFile)){
       thisPack = tmpTag.toJSON(myMeta, amf_storage);
       thisPack["bpos"] = lastBytePos;
       if ( !selectedTracks.count(thisPack["trackid"].asInt())){
         getNext();
       }
       break;
     }
   }
   if (FLV::Parse_Error){
     FAIL_MSG("FLV error: %s", FLV::Error_Str.c_str());
     thisPack.null();
     thisPacket.null();
     return;
   }
   std::string tmpStr = thisPack.toNetPacked();
   thisPacket.reInit(tmpStr.data(), tmpStr.size());
 }
Ejemplo n.º 4
0
void msgc(const deque<wstring>& params) {
  deque<FileNamePair> files;
  wstring header_file;
  parse_cmd_line(params, files, header_file);
  // load message files
  deque<MsgFile> msgs;
  for (unsigned i = 0; i < files.size(); i++) {
    msgs.push_back(load_msg_file(files[i].in));
    if (i) {
      if (msgs[i].msg_list != msgs[i - 1].msg_list) FAIL_MSG(L"Message files '" + files[i].in + L"' and '" + files[i - 1].in + L"' do not match");
    }
  }
  // create header file
  wstring header_data;
  for (unsigned i = 0; i < msgs[0].msg_list.size(); i++) {
    header_data.append(L"#define " + msgs[0].msg_list[i].id + L" " + int_to_str(i) + L"\n");
  }
  save_file(header_file, header_data, CP_ACP);
  // create Far language files
  wstring lng_data;
  for (unsigned i = 0; i < msgs.size(); i++) {
    lng_data = msgs[i].lang_tag + L'\n';
    for (unsigned j = 0; j < msgs[i].msg_list.size(); j++) {
      lng_data += msgs[i].msg_list[j].phrase + L'\n';
    }
    save_file(files[i].out, lng_data, msgs[i].code_page);
  }
}
Ejemplo n.º 5
0
void MFolderFromProfile::Delete()
{
   CHECK_RET( !m_folderName.empty(), _T("can't delete the root pseudo-folder") );

   // delete this folder from the parent profile
   String parentName = m_folderName.BeforeLast('/');
   Profile_obj profile(parentName);
   CHECK_RET( profile, _T("panic in MFolder: no profile") );

   profile->DeleteGroup(GetName());

   // let the parent now that its number of children changed
   MFolderFromProfile *parent = (MFolderFromProfile *)Get(parentName);
   if ( parent )
   {
      parent->OnSubfolderDelete();

      parent->DecRef();
   }
   else
   {
      // either we have managed to delete the root folder (bad) or something is
      // seriously wrong (even worse)
      FAIL_MSG( _T("no parent for deleted folder?") );
   }

   // notify everybody about the disappearance of the folder
   MEventManager::Send(
      new MEventFolderTreeChangeData (GetFullName(),
                                      MEventFolderTreeChangeData::Delete)
      );
}
Ejemplo n.º 6
0
 Chunk::Chunk(const void *_p, uint32_t len){
   p = (const char *)_p;
   if (len && len < getPayloadSize() + 8){
     FAIL_MSG("Chunk %s (%" PRIu32 "b) does not fit in %" PRIu32 " bytes length!", getType().c_str(),
              getPayloadSize() + 8, len);
     p = 0;
   }
 }
Ejemplo n.º 7
0
void farver(const deque<wstring>& params) {
  if (params.size() != 2)
    FAIL_MSG(L"Usage: farver <plugin.hpp> <farver.ini>");
  wstring text = load_file(params[0]);
  wstring result;
  result += L"FAR_VER_MAJOR = " + extract_version_number(text, L"FARMANAGERVERSION_MAJOR") + L"\n";
  result += L"FAR_VER_MINOR = " + extract_version_number(text, L"FARMANAGERVERSION_MINOR") + L"\n";
  result += L"FAR_VER_BUILD = " + extract_version_number(text, L"FARMANAGERVERSION_BUILD") + L"\n";
  save_file(params[1], result, CP_UTF8);
}
Ejemplo n.º 8
0
void attach_sfx_module(const wstring& file_path, const SfxOptions& sfx_options) {
  AttachSfxModuleProgress progress(file_path);

  {
    OpenOptions options;
    options.arc_path = file_path;
    options.detect = false;
    options.arc_types.push_back(c_7z);
    unique_ptr<Archives> archives(Archive::open(options));
    if (archives->empty())
      FAIL_MSG(Far::get_msg(MSG_ERROR_SFX_CONVERT));
    if (!archives->front()->is_pure_7z())
      FAIL_MSG(Far::get_msg(MSG_ERROR_SFX_CONVERT));
  }

  FindData file_data = File::get_find_data(file_path);
  progress.set_total(file_data.size());
  wstring dst_path = file_path + c_sfx_ext;
  try {
    create_sfx_module(dst_path, sfx_options);

    File dst_file(dst_path, FILE_WRITE_DATA | FILE_WRITE_ATTRIBUTES, FILE_SHARE_READ, OPEN_EXISTING, 0);
    dst_file.set_pos(0, FILE_END);

    File src_file(file_path, FILE_READ_DATA, FILE_SHARE_READ, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN);
    Buffer<char> buf(1024 * 1024);
    while (true) {
      unsigned size_read = src_file.read(buf.data(), static_cast<unsigned>(buf.size()));
      if (size_read == 0)
        break;
      CHECK(dst_file.write(buf.data(), size_read) == size_read);
      progress.update_completed(size_read);
    }

    File::set_attr(file_path, file_data.dwFileAttributes);
    dst_file.set_time(file_data.ftCreationTime, file_data.ftLastAccessTime, file_data.ftLastWriteTime);
  }
  catch (...) {
    File::delete_file_nt(dst_path);
    throw;
  }
  File::delete_file_nt(file_path);
}
Ejemplo n.º 9
0
MIME::Encoding MIME::GetEncodingForFontEncoding(wxFontEncoding enc)
{
   // QP should be used for the encodings which mostly overlap with US_ASCII,
   // Base64 for the others - choose the encoding method
   switch ( enc )
   {
      case wxFONTENCODING_ISO8859_1:
      case wxFONTENCODING_ISO8859_2:
      case wxFONTENCODING_ISO8859_3:
      case wxFONTENCODING_ISO8859_4:
      case wxFONTENCODING_ISO8859_9:
      case wxFONTENCODING_ISO8859_10:
      case wxFONTENCODING_ISO8859_13:
      case wxFONTENCODING_ISO8859_14:
      case wxFONTENCODING_ISO8859_15:

      case wxFONTENCODING_CP1250:
      case wxFONTENCODING_CP1252:
      case wxFONTENCODING_CP1254:
      case wxFONTENCODING_CP1257:

      case wxFONTENCODING_UTF7:
      case wxFONTENCODING_UTF8:
         return Encoding_QuotedPrintable;


      case wxFONTENCODING_ISO8859_5:
      case wxFONTENCODING_ISO8859_6:
      case wxFONTENCODING_ISO8859_7:
      case wxFONTENCODING_ISO8859_8:
      case wxFONTENCODING_ISO8859_11:
      case wxFONTENCODING_ISO8859_12:

      case wxFONTENCODING_CP1251:
      case wxFONTENCODING_CP1253:
      case wxFONTENCODING_CP1255:
      case wxFONTENCODING_CP1256:

      case wxFONTENCODING_KOI8:
#ifdef wxFONTENCODING_ISO2022_JP
      case wxFONTENCODING_ISO2022_JP:
#endif
      case wxFONTENCODING_SHIFT_JIS:
      case wxFONTENCODING_GB2312:
      case wxFONTENCODING_BIG5:
         return Encoding_Base64;

      default:
         FAIL_MSG( _T("unknown encoding") );

      case wxFONTENCODING_SYSTEM:
         return Encoding_Unknown;
   }
}
Ejemplo n.º 10
0
// recursive helper for CreateFolderMenu
void wxFolderMenuData::AddSubFoldersToMenu(wxString& folderName,
                                           MFolder *folder,
                                           wxMenu *menu,
                                           size_t& id)
{
   size_t nSubfolders = folder->GetSubfolderCount();
   for ( size_t n = 0; n < nSubfolders; n++ )
   {
      MFolder_obj subfolder(folder->GetSubfolder(n));
      if ( !subfolder.IsOk() )
      {
         FAIL_MSG( _T("no subfolder?") );

         continue;
      }

      // to allow moving the messages to the parent folder, create an entry
      // for it here (but don't do it for the root folder)
      if ( (n == 0) && (folder->GetType() != MF_ROOT) )
      {
         menu->Append(WXMENU_POPUP_FOLDER_MENU + id++, folder->GetName());
         m_folderNames.Add(folderName);
         menu->AppendSeparator();
      }

      wxString name = subfolder->GetName();
      wxString subfolderName = folderName;
      if ( !!subfolderName )
      {
         // there shouldn't be slash in the beginning
         subfolderName += '/';
      }
      subfolderName += name;

      if ( subfolder->GetSubfolderCount() == 0 )
      {
         // it's a simple menu item
         menu->Append(WXMENU_POPUP_FOLDER_MENU + id++, name);
      }
      else // subfolder has more subfolders, make it a submenu
      {
         wxMenu *submenu = new wxMenu;
         AddSubFoldersToMenu(subfolderName, subfolder, submenu, id);
         menu->Append(WXMENU_POPUP_FOLDER_MENU + id++, name, submenu);
      }

      // in any case, add it to the id->name map
      m_folderNames.Add(subfolderName);
   }
}
Ejemplo n.º 11
0
   // ctor & dtor
      // the folderName is the full profile path which should exist: it may be
      // created with Create() if Exists() returns false
   MFolderFromProfile(const String& folderName)
      : m_folderName(folderName)
   {
      m_nChildren = INVALID_CHILDREN_COUNT;

      m_profile = Profile::CreateFolderProfile(m_folderName);
      if ( !m_profile )
      {
         // this should never happen
         FAIL_MSG( _T("invalid MFolderFromProfile name!") );

         // to avoid crashes later
         m_profile = mApplication->GetProfile();
         m_profile->IncRef();
      }
   }
Ejemplo n.º 12
0
MFolder *MFolderFromProfile::GetSubfolder(size_t n) const
{
   // IndexTraversal is not used any more because it quite inefficient and this
   // function is called a *lot* of times
   IndexTraversal index(this, n);

   // don't recurse into subfolders
   if ( index.Traverse(false) )
   {
      FAIL_MSG( _T("invalid index in MFolderFromProfile::GetSubfolder()") );

      return NULL;
   }
   //else: not all folders traversed, i.e. the right one found

   return Get(index.GetName());
}
Ejemplo n.º 13
0
PGPFilter::PGPFilter(MessageView *msgView, ViewFilter *next, bool enable)
         : ViewFilter(msgView, next, enable)
{
   MModuleListing *listing =
      MModule::ListAvailableModules(CRYPTO_ENGINE_INTERFACE);
   if ( listing )
   {
      const size_t count = listing->Count();
      for ( size_t n = 0; n < count; n++ )
      {
         const MModuleListingEntry& entry = (*listing)[n];

         const String& name = entry.GetName();
         if ( name == _T("PGPEngine") )
         {
            MCryptoEngineFactory * const factory
               = (MCryptoEngineFactory *)MModule::LoadModule(name);
            if ( factory )
            {
               m_engine = factory->Get();

               factory->DecRef();
            }
            else
            {
               FAIL_MSG( _T("failed to create PGPEngineFactory") );
            }
         }
      }

      listing->DecRef();
   }

   if ( !m_engine )
   {
      wxLogError(_("Failed to load PGP engine module.\n"
                   "\n"
                   "Support for PGP in message viewer will be unavailable") );

      // TODO: disable completely
      Enable(false);
   }
}
Ejemplo n.º 14
0
/// A small helper function to expand mailfolder names:
String
strutil_expandfoldername(const String &name, MFolderType folderType)
{
   if( folderType != MF_FILE && folderType != MF_MH)
       return name;

   if ( strutil_isabsolutepath(name) )
      return strutil_expandpath(name);

   if ( folderType == MF_FILE )
   {
      String mboxpath = READ_APPCONFIG(MP_MBOXDIR);
      if ( mboxpath.empty() || !strutil_isabsolutepath(mboxpath) )
         mboxpath = mApplication->GetLocalDir() + DIR_SEPARATOR + mboxpath;

      if ( !mboxpath.empty() )
         mboxpath += DIR_SEPARATOR;

      mboxpath += name;

      return strutil_expandpath(mboxpath);
   }
   else // if ( folderType == MF_MH )
   {
      // the name is a misnomer, it is used here just to get MHPATH value
      String mhpath = MailFolder::InitializeMH();
      if ( !mhpath )
      {
         // oops - failed to init MH
         FAIL_MSG(_T("can't construct MH folder full name"));
      }
      else
      {
         mhpath += name;
      }

      return mhpath; // no need to expand, MHPATH should be already expanded
   }
}
Ejemplo n.º 15
0
 virtual void Delete()
    { FAIL_MSG(_T("can not delete root folder.")); }
Ejemplo n.º 16
0
void CDBConnection::execute(const TNewReservationTxnInput* pIn, TNewReservationTxnOutput* pOut){

	pOut->status = CBaseTxnErr::SUCCESS;

	char query[4096];
	sql_result_t result;
	sql_result_t result_t;
	int length;
	char* val;
	int r = 0;

	int seatnum = pIn->seatnum;
	int seat_total = 0;
	int al_id;
	int seats_left;
	int c_base_ap_id;
	float c_balance;

	int rnd = rand()%65536;

//========ORIG===========

	NR_GETFLIGHT;

	NR_CHECKSEAT;

	NR_CHECKCUSTOMER;

	NR_GETCUSTOMER;

	sprintf(query, NR_UPDATE_FLIGHT, pIn->f_id);
	GETTIME;
	if(!dbt5_sql_execute(query, &result, "UPDATE_FLIGHT")){
			FAIL_MSG("NR_UPDATE_FLIGHT");
	}
	ADD_QUERY_NODE(1, 5, 1);

//	sprintf(query, NR_INSERT_RESERVATION, pIn->r_id, pIn->c_id, pIn->f_id, seatnum, pIn->price, rnd, rnd+10, rnd+20, rnd+30, rnd+40, rnd+50, rnd+60, rnd+70, rnd+80);
//
//	GETTIME;
//	if(!dbt5_sql_execute(query, &result, "INSERT_RESERVATION")){
//			FAIL_MSG("NR_INSERT_RESERVATION fails...");
//	}
//	ADD_QUERY_NODE(1, 8, 1);



	sprintf(query, NR_UPDATE_CUSTOMER, rnd+200, rnd+300, rnd+400, rnd+500, pIn->c_id);
	GETTIME;
	if(!dbt5_sql_execute(query, &result, "UPDATE_CUSTOMER")){
			FAIL_MSG("NR_UPDATE_CUSTOMER fails...");
	}
	ADD_QUERY_NODE(1, 6, 1);

	sprintf(query, NR_UPDATE_FREQUENT_FLYER, rnd+1, rnd+2, rnd+3, rnd+4, pIn->c_id, al_id);
	GETTIME;
	dbt5_sql_execute(query, &result, "UPDATE_FREQUENT_FLYER");
	ADD_QUERY_NODE(1, 7, 1);

	sprintf(query, NR_INSERT_RESERVATION, pIn->r_id, pIn->c_id, pIn->f_id, seatnum, pIn->price, rnd, rnd+10, rnd+20, rnd+30, rnd+40, rnd+50, rnd+60, rnd+70, rnd+80);

	GETTIME;
	if(!dbt5_sql_execute(query, &result, "INSERT_RESERVATION")){
			FAIL_MSG("NR_INSERT_RESERVATION fails...");
	}
	ADD_QUERY_NODE(1, 8, 1);

//===========END ORIGIN=========


/*
//--------REORDER----------
	NR_CHECKCUSTOMER;

	NR_GETCUSTOMER;

	NR_GETFLIGHT;

	NR_CHECKSEAT;


	sprintf(query, NR_UPDATE_FREQUENT_FLYER, rnd+1, rnd+2, rnd+3, rnd+4, pIn->c_id, al_id);
	GETTIME;
	dbt5_sql_execute(query, &result, "UPDATE_FREQUENT_FLYER");
	ADD_QUERY_NODE(1, 7, 1);

	sprintf(query, NR_UPDATE_CUSTOMER, rnd+200, rnd+300, rnd+400, rnd+500, pIn->c_id);
	GETTIME;
	if(!dbt5_sql_execute(query, &result, "UPDATE_CUSTOMER")){
			FAIL_MSG("NR_UPDATE_CUSTOMER fails...");
	}
	ADD_QUERY_NODE(1, 6, 1);

	sprintf(query, NR_UPDATE_FLIGHT, pIn->f_id);
	GETTIME;
	if(!dbt5_sql_execute(query, &result, "UPDATE_FLIGHT")){
			FAIL_MSG("NR_UPDATE_FLIGHT");
	}
	ADD_QUERY_NODE(1, 5, 1);

	sprintf(query, NR_INSERT_RESERVATION, pIn->r_id, pIn->c_id, pIn->f_id, seatnum, pIn->price, rnd, rnd+10, rnd+20, rnd+30, rnd+40, rnd+50, rnd+60, rnd+70, rnd+80);
	GETTIME;
	if(!dbt5_sql_execute(query, &result, "INSERT_RESERVATION")){
			FAIL_MSG("NR_INSERT_RESERVATION fails...");
	}
	ADD_QUERY_NODE(1, 8, 1);
*/

}
Ejemplo n.º 17
0
 virtual bool Rename(const String& /* newName */)
    { FAIL_MSG(_T("can not rename root folder.")); return false; }
Ejemplo n.º 18
0
String
strutil_extract_formatspec(const wxChar *format)
{
   // TODO doesn't recognize all possible formats nor backslashes (!)
   String specs;
   while ( *format != '\0' ) {
      if ( *format == '%' ) {
         // skip flags, width and precision which may optionally follow '-'
         while ( !isalpha(*format) )
            format++;

         // size prefix
         enum SizePrefix
         {
            Size_None,
            Size_Short,
            Size_Long
         } sizePrefix;
         switch ( *format ) {
            case 'h':
               sizePrefix = Size_Short;
               format++;
               break;

            case 'l':
            case 'L':
               sizePrefix = Size_Long;
               format++;
               break;

            default:
               sizePrefix = Size_None;
         }

         // keep the compiler happy by initializing the var in any case
         char ch = '\0';
         switch ( *format ) {
            // these are all types I know about
            case 'c':
            case 'C':
               ch = 'c';
               break;

            case 'd':
            case 'i':
            case 'o':
            case 'u':
            case 'x':
            case 'X':
               switch ( sizePrefix ) {
                  case Size_None:
                     ch = 'd';
                     break;

                  case Size_Short:
                     ch = 'h';
                     break;

                  case Size_Long:
                     ch = 'l';
                     break;

                  default:
                     FAIL_MSG(_T("unknown size field"));
               }
               break;

            case 'e':
            case 'E':
            case 'f':
            case 'g':
            case 'G':
               ch = 'f';
               break;

            case 'n':
            case 'p':
               ch = 'p';
               break;

            case 's':
            case 'S':
               ch = 's';
               break;
         }

         if ( ch != '\0' ) {
            specs += ch;
         }
      }

      format++;
   }

   return specs;
}
Ejemplo n.º 19
0
 virtual AdbEntryGroup *GetGroup(const String&) const
    { FAIL_MSG( _T("LineBook::GetGroup was called.") ); return NULL; }
Ejemplo n.º 20
0
bool MFolderFromProfile::Create(const String& fullname)
{
   // update the count of children in the immediate parent of the folder we're
   // going to create

   // split path into '/' separated components
   wxArrayString components;
   wxSplitPath(components, fullname);

   bool updatedCount = false;

   String path, component;

   Profile *profile = Profile::CreateFolderProfile(wxEmptyString);

   size_t n,
          count = components.GetCount();
   for ( n = 0; n < count; n++ )
   {
      CHECK( profile, false, _T("failed to create profile?") );

      component = components[n];

      if ( !updatedCount )
      {
         if ( profile->readEntryFromHere(component + _T('/') + MP_FOLDER_TYPE,
                                         MF_ILLEGAL) == MF_ILLEGAL )
         {
            MFolderFromProfile *folder = (MFolderFromProfile *)MFolder::Get(path);
            if ( !folder )
            {
               FAIL_MSG( _T("this folder must already exist!") );
            }
            else
            {
               // we have to invalidate it - unfortunately we can't just
               // increase it because we may have a situation like this:
               //
               //    1. Create("a/b/c")
               //    2. Create("a/b")
               //    3. Create("a")
               //
               // and then, assuming 'a' hadn't existed before, the children
               // count of the root folder would be incremented thrice even
               // though only one new children was created
               folder->m_nChildren = INVALID_CHILDREN_COUNT;

               folder->DecRef();
            }

            // this is the the last existing folder for which we have anything to
            // update
            updatedCount = true;
         }
      }

      // go down
      if ( !path.empty() )
         path += _T('/');
      path += components[n];

      profile->DecRef();
      profile = Profile::CreateFolderProfile(path);
   }

   // we need to write something to this group to really create it
   profile->writeEntry(MP_FOLDER_TYPE, MF_ILLEGAL);

   profile->DecRef();

   return true;
}
Ejemplo n.º 21
0
void MFolderFromProfile::SetServer(const String& /* server */)
{
   // it's not used now...
   FAIL_MSG( _T("not implemented") );
}
Ejemplo n.º 22
0
 virtual void SetName(const String&)
 {
    FAIL_MSG( _T("Nobody asked LineBook whether it supports SetName.") );
 }
Ejemplo n.º 23
0
 virtual void DeleteGroup(const String&)
    { FAIL_MSG( _T("LineBook::DeleteGroup was called.") ); }
Ejemplo n.º 24
0
 virtual AdbEntryGroup *CreateGroup(const String&)
 {
    FAIL_MSG(
       _T("Nobody asked LineBook whether it supports CreateGroup.") );
    return NULL;
 }
Ejemplo n.º 25
0
bool MfStatusCache::DoLoad(const wxTextFile& file, int version)
{
   bool isFmtOk = true;

   CacheFileFormat fmt;
   if ( version == BuildVersion(1, 1) )
   {
      fmt = CacheFile_1_1;
   }
   else if ( version == BuildVersion(1, 0) )
   {
      fmt = CacheFile_1_0;
   }
   else
   {
      fmt = CacheFile_Max;
   }

   // read the data
   wxString str, name;
   str.Alloc(1024);     // avoid extra memory allocations
   name.Alloc(1024);

   MailFolderStatus status;

   size_t count = file.GetLineCount();
   for ( size_t n = 1; n < count; n++ )
   {
      str = file[n];

      // first get the end of the full folder name knowing that we should
      // skip all "::" as they could have only resulted from quoting a ':'
      // in the folder name and so the loop below looks for the first ':'
      // not followed by another ':'
      const wxChar *p = wxStrchr(str, CACHE_DELIMITER_CH);
      while ( p && p[1] == CACHE_DELIMITER_CH )
      {
         p = wxStrchr(p + 2, CACHE_DELIMITER_CH);
      }

      if ( !p )
      {
         wxLogError(_("Missing '%c' at line %d."), CACHE_DELIMITER_CH, n + 1);

         isFmtOk = false;

         break;
      }

      name = wxString(str.c_str(), p);

      // now unquote ':' which were doubled by Save()
      name.Replace(CACHE_DELIMITER CACHE_DELIMITER, CACHE_DELIMITER);

      // get the rest
      status.Init();
      switch ( fmt )
      {
         case CacheFile_1_0:
            isFmtOk = wxSscanf(p + 1,
                             _T("%lu") CACHE_DELIMITER
                             _T("%lu") CACHE_DELIMITER
                             _T("%lu"),
                             &status.total,
                             &status.unread,
                             &status.flagged) == 3;
            break;

         default:
            FAIL_MSG( _T("unknown cache file format") );
            // fall through nevertheless

         case CacheFile_1_1:
            isFmtOk = wxSscanf(p + 1,
                             _T("%lu") CACHE_DELIMITER
                             _T("%lu") CACHE_DELIMITER 
                             _T("%lu") CACHE_DELIMITER
                             _T("%lu"),
                             &status.total,
                             &status.newmsgs,
                             &status.unread,
                             &status.flagged) == 4;
      }

      if ( !isFmtOk )
      {
         wxLogError(_("Missing field(s) at line %d."), n + 1);

         break;
      }

      // ignore the folders which were deleted during the last program run
      MFolder *folder = MFolder::Get(name);
      if ( folder )
      {
         folder->DecRef();

         // do add the entry to the cache
         size_t entry = m_folderNames.Add(name);
         m_folderData.Insert(new MailFolderStatus(status), entry);
      }
      else
      {
         wxLogDebug(_T("Removing deleted folder '%s' from status cache."),
                    name.c_str());
      }
   }

   if ( !isFmtOk )
   {
      wxLogWarning(_("Your mail folder status cache file (%s) was corrupted."),
                   file.GetName());

      return false;
   }

   return true;
}
Ejemplo n.º 26
0
void CDBConnection::execute(const TBiddingTxnInput* pIn, TBiddingTxnOutput* pOut){
	pOut->status = CBaseTxnErr::SUCCESS;

	char query[4096];
	sql_result_t result;
	int length;
	char* val;
	int r = 0;

	string user_name;
	string item_description;
	string rec_description = get_random_string(128);
	uint64_t bid;
	uint64_t pid;
	double cur_price;
	double bid_price;

#ifndef QURO
	sprintf(query, SELECT_ITEM, pIn->item_id);
	//CLANG_PROFILE;
	r = dbt5_sql_execute(query, &result, "GET_ITEM");
	if(r==1 && result.result_set){
		dbt5_sql_fetchrow(&result);
		cur_price = atof(dbt5_sql_getvalue(&result, 0, length));
		val = dbt5_sql_getvalue(&result, 1, length);
		item_description.assign(val);
		dbt5_sql_close_cursor(&result);
	}else{
		FAIL_MSG("GET_ITEM FAIL");
	}

	sprintf(query, GET_USER, pIn->user_id);
	//CLANG_PROFILE;
	r = dbt5_sql_execute(query, &result, "GET_USERS");
	if(r==1 && result.result_set){
		dbt5_sql_fetchrow(&result);
		bid = atol(dbt5_sql_getvalue(&result, 0, length));
		val = dbt5_sql_getvalue(&result, 1, length);
		user_name.assign(val);
		dbt5_sql_close_cursor(&result);
	}else{
		FAIL_MSG("GET_USER FAIL");
	}


	if(double(rand()%128)/128.0 < HIGHER_BID_THRESHOLD)
					bid_price = cur_price + double(rand()%16)/16.0;
	else
					bid_price = cur_price - double(rand()%128)/128.0;


	if(bid_price > cur_price){
		BIDDING_UPDATE_ITEM;
	}

	BIDDING_UPDATE_USER;

	BIDDING_INSERT_REC;

#else

	sprintf(query, GET_USER, pIn->user_id);
	//CLANG_PROFILE;
	r = dbt5_sql_execute(query, &result, "GET_USERS");
	if(r==1 && result.result_set){
		dbt5_sql_fetchrow(&result);
		bid = atol(dbt5_sql_getvalue(&result, 0, length));
		val = dbt5_sql_getvalue(&result, 1, length);
		user_name.assign(val);
		dbt5_sql_close_cursor(&result);
	}else{
		FAIL_MSG("GET_USER FAIL");
	}

	BIDDING_UPDATE_USER;

	sprintf(query, SELECT_ITEM, pIn->item_id);
	//CLANG_PROFILE;
	r = dbt5_sql_execute(query, &result, "GET_ITEM");
	if(r==1 && result.result_set){
		dbt5_sql_fetchrow(&result);
		cur_price = atof(dbt5_sql_getvalue(&result, 0, length));
		val = dbt5_sql_getvalue(&result, 1, length);
		item_description.assign(val);
		dbt5_sql_close_cursor(&result);
	}else{
		FAIL_MSG("GET_ITEM FAIL");
	}


	BIDDING_INSERT_REC;
	if(bid_price > cur_price){
		BIDDING_UPDATE_ITEM;
	}
#endif

}
Ejemplo n.º 27
0
void
wxMFrame::OnMenuCommand(int id)
{
   // is it a module generated entry?
   if(id >= WXMENU_MODULES_BEGIN && id < WXMENU_MODULES_END)
   {
      ProcessModulesMenu(id);
      return;
   }

   switch(id)
   {
      case WXMENU_FILE_CLOSE:
         Close();
         break;

      case WXMENU_FILE_COMPOSE_WITH_TEMPLATE:
      case WXMENU_FILE_COMPOSE:
         {
            wxString templ;
            if ( id == WXMENU_FILE_COMPOSE_WITH_TEMPLATE )
            {
               templ = ChooseTemplateFor(MessageTemplate_NewMessage, this);
               if ( templ.empty() )
               {
                  // cancelled by user
                  break;
               }
            }

            Profile_obj profile(GetFolderProfile());
            Composer *composeView = Composer::CreateNewMessage(templ, profile);

            composeView->InitText();
         }
         break;

      case WXMENU_FILE_SEND_OUTBOX:
         mApplication->SendOutbox();
         break;

      case WXMENU_FILE_POST:
         {
            Profile_obj profile(GetFolderProfile());
            Composer *composeView = Composer::CreateNewArticle(profile);

            composeView->InitText();
         }

      case WXMENU_FILE_COLLECT:
         {
            FolderMonitor *mailCollector = mApplication->GetFolderMonitor();
            if ( mailCollector )
            {
               // when the user explicitly checks for the new mail, also update
               // the currently opened folder(s) and give the verbose messages
               mailCollector->CheckNewMail(FolderMonitor::Interactive |
                                           FolderMonitor::Opened);
            }
         }
         break;

#ifdef USE_PYTHON
      case WXMENU_FILE_RUN_PYSCRIPT:
         {
            wxString path = mApplication->GetDataDir();
            if ( !path.empty() )
               path += DIR_SEPARATOR;
            path += _T("scripts");

            wxString filename = MDialog_FileRequester
                                (
                                 _("Please select a Python script to run."),
                                 this,
                                 path, "",
                                 "py", "*.py",
                                 false,
                                 NULL /* profile */
                                );
            if ( !filename.empty() )
            {
               PythonRunScript(filename);
            }
            //else: cancelled by user
         }
         break;
#endif   // USE_PYTHON

      case WXMENU_FILE_AWAY_MODE:
         mApplication->SetAwayMode(GetMenuBar()->IsChecked(id));
         break;

      case WXMENU_FILE_EXIT:
         // flush MEvent queues for safety
         MEventManager::DispatchPending();

         if ( CanClose() )
         {
            // this frame has been already asked whether it wants to exit, so
            // don't ask it again
            mApplication->AddToFramesOkToClose(this);

            // exit the application if other frames don't object
            mApplication->Exit();
         }
         break;

      case WXMENU_FILE_IMPORT:
         ShowImportDialog(this);
         break;

      case WXMENU_EDIT_ADB:
         ShowAdbFrame(this);
         break;

      case WXMENU_EDIT_PREF:
         ShowOptionsDialog(this);
         break;

      case WXMENU_EDIT_FILTERS:
         (void) ConfigureAllFilters(this);
         break;

      case WXMENU_EDIT_MODULES:
         ShowModulesDialog(this);
         break;

      case WXMENU_EDIT_TEMPLATES:
         EditTemplates(this);
         break;

      case WXMENU_EDIT_RESTORE_PREF:
         (void)ShowRestoreDefaultsDialog(mApplication->GetProfile(), this);
         break;

      case WXMENU_EDIT_SAVE_PREF:
         if ( Profile::FlushAll() )
         {
            wxLogStatus(this, _("Program preferences successfully saved."));
         }
         else
         {
            ERRORMESSAGE((_("Couldn't save preferences.")));
         }
         break;

      case WXMENU_EDIT_CONFIG_SOURCES:
         ShowConfigSourcesDialog(this);
         break;

      case WXMENU_EDIT_EXPORT_PREF:
      case WXMENU_EDIT_IMPORT_PREF:
         {
            const bool doExport = id == WXMENU_EDIT_EXPORT_PREF;

            String path = MDialog_FileRequester
                          (
                              doExport ? _("Choose file to export settings to")
                                       : _("Choose file to import settings from"),
                              this,
                              wxEmptyString, wxEmptyString, wxEmptyString, wxEmptyString,
                              doExport    // true => save, false => load
                          );
            if ( path.empty() )
               break;

            ConfigSource_obj
               configSrc(ConfigSourceLocal::CreateDefault()),
               configDst(ConfigSourceLocal::CreateFile(path));
            if ( !doExport )
            {
               configSrc.Swap(configDst);
            }

            bool ok = ConfigSource::Copy(*configDst, *configSrc);

            if ( doExport )
            {
               if ( ok )
               {
                  wxLogStatus(this,
                              _("Settings successfully exported to file \"%s\""),
                              path.c_str());
               }
               else
               {
                  wxLogError(_("Failed to export settings to the file \"%s\"."),
                             path.c_str());
               }
            }
            else // import
            {
               if ( ok )
               {
                  wxLogStatus(this,
                              _("Settings successfully imported from \"%s\""),
                              path.c_str());
               }
               else
               {
                  wxLogError(_("Failed to import settings from the file \"%s\"."),
                             path.c_str());
               }
            }
         }
         break;


      case WXMENU_HELP_ABOUT:
         MDialog_AboutDialog(this, false /* don't timeout */);
         break;

      case WXMENU_HELP_TIP:
         MDialog_ShowTip(this);
         break;

      case WXMENU_HELP_CONTEXT:
         MDialog_Message(_("Help not implemented for current context, yet."),this,_("Sorry"));
         break;

      case WXMENU_HELP_CONTENTS:
         mApplication->Help(MH_CONTENTS,this);
         break;

      case WXMENU_HELP_RELEASE_NOTES:
         mApplication->Help(MH_RELEASE_NOTES,this);
         break;

      case WXMENU_HELP_FAQ:
         mApplication->Help(MH_FAQ,this);
         break;

      case WXMENU_HELP_SEARCH:
         mApplication->Help(MH_SEARCH,this);
         break;

      case WXMENU_HELP_COPYRIGHT:
         mApplication->Help(MH_COPYRIGHT,this);
         break;

         // printing:
      case WXMENU_FILE_PRINT_SETUP:
         OnPrintSetup();
         break;
      case WXMENU_FILE_PAGE_SETUP:
         OnPageSetup();
         break;

#ifdef USE_PS_PRINTING
      case WXMENU_FILE_PRINT_SETUP_PS:
         OnPrintSetup();
         break;

      case WXMENU_FILE_PAGE_SETUP_PS:
         OnPageSetup();
         break;
#endif // USE_PS_PRINTING

#ifdef USE_DIALUP
      case WXMENU_FILE_NET_ON:
         mApplication->GoOnline();
         break;

      case WXMENU_FILE_NET_OFF:
         if(mApplication->CheckOutbox())
         {
            if ( MDialog_YesNoDialog
                 (
                  _("You have outgoing messages queued.\n"
                    "Do you want to send them before going offline?"),
                  this,
                  MDIALOG_YESNOTITLE,
                  M_DLG_YES_DEFAULT,
                  M_MSGBOX_GO_OFFLINE_SEND_FIRST
                 ) )
            {
               mApplication->SendOutbox();
            }
         }
         mApplication->GoOffline();
         break;
#endif // USE_DIALUP

         // create a new identity and edit it
      case WXMENU_FILE_IDENT_ADD:
         {
            wxString ident;
            if ( MInputBox(&ident,
                           _("Mahogany: Create new identity"),
                           _("Enter the identity name:"),
                           this,
                           "NewIdentity") )
            {
               ShowIdentityDialog(ident, this);

               // update the identity combo in the toolbar of the main frame if
               // any (note that this will update all the other existing
               // identity combo boxes as they keep themselves in sync
               // internally)
               //
               // TODO: we really should have a virtual wxMFrame::GetIdentCombo
               //       as we might not always create the main frame in the
               //       future but other frames (e.g. composer) may have the
               //       ident combo as well
               wxMFrame *frameTop = mApplication->TopLevelFrame();
               if ( frameTop )
               {
                  wxToolBar *tbar = frameTop->GetToolBar();
                  if ( tbar )
                  {
                     wxWindow *win = tbar->FindWindow(IDC_IDENT_COMBO);
                     if ( win )
                     {
                        wxChoice *combo = wxDynamicCast(win, wxChoice);
                        combo->Append(ident);
                     }
                  }
                  else
                  {
                     FAIL_MSG(_T("where is the main frames toolbar?"));
                  }
               }

               wxLogStatus(this, _("Created new identity '%s'."), ident.c_str());
            }
         }
         break;

         // change the current identity
      case WXMENU_FILE_IDENT_CHANGE:
         {
            wxArrayString identities = Profile::GetAllIdentities();
            if ( identities.IsEmpty() )
            {
               wxLogError(_("There are no existing identities to choose from.\n"
                            "Please create an identity first."));
            }
            else
            {
               identities.Insert(_("Default"), 0);
               int rc = MDialog_GetSelection
                        (
                         _("Select the new identity"),
                         MDIALOG_YESNOTITLE,
                         identities,
                         this
                        );

               if ( rc != -1 )
               {
                  Profile *profile = mApplication->GetProfile();
                  if ( rc == 0 )
                  {
                     // restore the default identity
                     profile->DeleteEntry(GetOptionName(MP_CURRENT_IDENTITY));
                  }
                  else
                  {
                     wxString ident = identities[(size_t)rc];
                     profile->writeEntry(MP_CURRENT_IDENTITY, ident);
                  }

                  // update the identity combo in the toolbar if any
                  wxWindow *win = GetToolBar()->FindWindow(IDC_IDENT_COMBO);
                  if ( win )
                  {
                     wxChoice *combo = wxDynamicCast(win, wxChoice);
                     combo->SetSelection(rc);
                  }

                  // TODO: should update everything (all options might have
                  //       changed)
               }
               //else: dialog cancelled, nothing to do
            }
         }
         break;

         // edit an identity's parameters
      case WXMENU_FILE_IDENT_EDIT:
         {
            String ident;
            wxArrayString identities = Profile::GetAllIdentities();
            if ( identities.IsEmpty() )
            {
               wxLogError(_("There are no existing identities to edit.\n"
                            "Please create an identity first."));
            }
            else
            {
               if ( identities.GetCount() > 1 )             
               {
                  int rc = MDialog_GetSelection
                           (
                            _("Which identity would you like to edit?"),
                            MDIALOG_YESNOTITLE,
                            identities,
                            this
                           );

                  if ( rc != -1 )
                  {
                     ident = identities[(size_t)rc];
                  }
                  //else: dialog was cancelled
               }
               else // only one identity
               {
                  // use the current one
                  ident = READ_APPCONFIG_TEXT(MP_CURRENT_IDENTITY);
               }
            }

            if ( !ident.empty() )
            {
               ShowIdentityDialog(ident, this);
            }
         }
         break;

      case WXMENU_FILE_IDENT_DELETE:
         {
            String ident;
            wxArrayString identities = Profile::GetAllIdentities();
            if ( identities.IsEmpty() )
            {
               wxLogError(_("There are no existing identities to delete."));
            }
            else
            {
               int rc = MDialog_GetSelection
                        (
                         _("Which identity would you like to delete?"),
                         MDIALOG_YESNOTITLE,
                         identities,
                         this
                        );
               if ( rc != -1 )
               {
                  ident = identities[(size_t)rc];
               }
               //else: cancelled
            }

            if ( !ident.empty() )
            {
               Profile *profile = mApplication->GetProfile();

               if ( ident == READ_APPCONFIG(MP_CURRENT_IDENTITY) )
               {
                  // can't keep this one
                  profile->writeEntry(MP_CURRENT_IDENTITY, wxEmptyString);
               }

               // FIXME: will this really work? if there are objects which
               //        use this identity the section will be recreated...
               String identSection;
               identSection << Profile::GetIdentityPath() << '/' << ident;
               profile->DeleteGroup(identSection);

               // update the identity combo in the toolbar if any
               wxWindow *win = GetToolBar()->FindWindow(IDC_IDENT_COMBO);
               if ( win )
               {
                  wxChoice *combo = wxDynamicCast(win, wxChoice);
                  combo->Delete(combo->FindString(ident));
               }

               wxLogStatus(this, _("Identity '%s' deleted."), ident.c_str());
            }
         }
         break;

      case WXMENU_LANG_SET_DEFAULT:
         {
            static const wxFontEncoding encodingsSupported[] =
            {
               wxFONTENCODING_ISO8859_1,       // West European (Latin1)
               wxFONTENCODING_ISO8859_2,       // Central and East European (Latin2)
               wxFONTENCODING_ISO8859_3,       // Esperanto (Latin3)
               wxFONTENCODING_ISO8859_4,       // Baltic (old) (Latin4)
               wxFONTENCODING_ISO8859_5,       // Cyrillic
               wxFONTENCODING_ISO8859_6,       // Arabic
               wxFONTENCODING_ISO8859_7,       // Greek
               wxFONTENCODING_ISO8859_8,       // Hebrew
               wxFONTENCODING_ISO8859_9,       // Turkish (Latin5)
               wxFONTENCODING_ISO8859_10,      // Variation of Latin4 (Latin6)
               wxFONTENCODING_ISO8859_11,      // Thai
               wxFONTENCODING_ISO8859_12,      // doesn't exist currently, but put it
                                               // here anyhow to make all ISO8859
                                               // consecutive numbers
               wxFONTENCODING_ISO8859_13,      // Baltic (Latin7)
               wxFONTENCODING_ISO8859_14,      // Latin8
               wxFONTENCODING_ISO8859_15,      // Latin9 (a.k.a. Latin0, includes euro)

               wxFONTENCODING_CP1250,          // WinLatin2
               wxFONTENCODING_CP1251,          // WinCyrillic
               wxFONTENCODING_CP1252,          // WinLatin1
               wxFONTENCODING_CP1253,          // WinGreek (8859-7)
               wxFONTENCODING_CP1254,          // WinTurkish
               wxFONTENCODING_CP1255,          // WinHebrew
               wxFONTENCODING_CP1256,          // WinArabic
               wxFONTENCODING_CP1257,          // WinBaltic (almost the same as Latin 7)

               wxFONTENCODING_KOI8,            // == KOI8-R
               wxFONTENCODING_UTF7,            // == UTF-7
               wxFONTENCODING_UTF8,            // == UTF-8
            };

            wxArrayString encDescs;
            encDescs.Add(_("Default 7 bit (US ASCII)"));
            for ( size_t n = 0; n < WXSIZEOF(encodingsSupported); n++ )
            {
               encDescs.Add(
                     wxFontMapper::GetEncodingDescription(
                        encodingsSupported[n]
                     )
               );
            }

            int choice = MDialog_GetSelection
                         (
                           _("Please choose the default encoding:\n"
                             "it will be used by default in both\n"
                             "message viewer and composer."),
                           _("Choose default encoding"),
                           encDescs,
                           this
                         );

            wxFontEncoding enc;
            if ( choice == -1 )
            {
               // cancelled, do nothing
               break;
            }
            else if ( choice == 0 )
            {
               enc = wxFONTENCODING_DEFAULT;
            }
            else
            {
               enc = encodingsSupported[choice - 1];
            }

            // remember the encoding as default
            mApplication->GetProfile()->writeEntry(MP_MSGVIEW_DEFAULT_ENCODING,
                                                   enc);
         }
         break;

      case WXMENU_VIEW_TOOLBAR:
         if ( GetMenuBar()->IsChecked(id) )
         {
            DoCreateToolBar();
         }
         else // hide the toolbar
         {
            delete GetToolBar();
            SetToolBar(NULL);
         }
         break;

      case WXMENU_VIEW_STATUSBAR:
         if ( GetMenuBar()->IsChecked(id) )
         {
            DoCreateStatusBar();
         }
         else // hide the status bar
         {
            delete GetStatusBar();
            SetStatusBar(NULL);
         }
         break;

      case WXMENU_VIEW_FULLSCREEN:
         ShowFullScreen(GetMenuBar()->IsChecked(id));
         break;
   }
}
Ejemplo n.º 28
0
 virtual bool Move(const MFolder* /* newParent */)
    { FAIL_MSG(_T("can not move root folder.")); return false; }
Ejemplo n.º 29
0
String
MFDialogComponent::WriteTest(void)
{
   String program;

   CHECK( m_Test >= 0 && m_Test < ORC_T_Max, program,
          _T("illegal filter test") );

   // This returns the bit to go into an if between the brackets:
   // if ( .............. )
   switch(m_Logical)
   {
      case ORC_L_Or: // OR:
         program << '|';
         break;

      case ORC_L_And: // AND:
         program << '&';
         break;

      default:
         FAIL_MSG( _T("unknown logical filter operation") );

      case ORC_L_None:
         break;
   }

   program << '(';
   if ( m_Inverted )
      program << '!';


   program << ORC_T_Names[m_Test];

   bool needsClosingParen = program.Last() == '(';

   bool needsTarget = FilterTestNeedsTarget(m_Test);
   if(needsTarget)
   {
      CHECK(m_Target != ORC_W_Illegal && m_Target < ORC_W_Max, wxEmptyString,
               "invalid target value");

      program << ORC_W_Names[m_Target];

      // this one is special as it has an extra argument of its own
      if ( m_Target == ORC_W_Header )
         program << "(\"" << m_TargetArgument << "\")";
   }

   bool needsArgument = FilterTestNeedsArgument(m_Test);
   if(needsTarget && needsArgument)
      program << ',';
   if(needsArgument)
   {
      // use strutil_escapeString() here to prevent misparsing the quotes
      // embedded into m_Argument as string terminator characters
      program << '"' << strutil_escapeString(m_Argument) << '"';
   }
   if ( needsClosingParen )
      program << ')'; // end of function call
   program << ')';

   return program;
}
Ejemplo n.º 30
0
 virtual void SetDescription(const String&)
 {
    FAIL_MSG(
       _T("Nobody asked LineBook whether it supports SetDescription.") );
 }