Exemplo n.º 1
0
int main (void)
{
	ifstream input;
	ofstream output;
	string fileName;
	int key;
	FileFilter *file;
	cout << "Enter Filename: ";
	cin >> fileName;
	input.open (fileName.c_str (), ios::in);
	input.clear ();
	input.seekg (0, ios::beg);
	cout << "Enter File to Output To: ";
	cin >> fileName;
	output.open (fileName.c_str (), ios::out);
	cout << "Select Mode (1 = Copy, 2 = To Upper, 3 = Encrypt, 4 = Double Space): ";
	cin >> key;
	if (key == 1)
	{
		file = new cpyFl;
		file->doFilter (input, output, key);
	}
	else if (key == 2)
	{
		file = new tupFl;
		file->doFilter (input, output, key);
	}
	else if (key == 3)
	{
		cout << "Key? ";
		cin >> key;
		file = new encFl;
		file->doFilter (input, output, key);
	}
Exemplo n.º 2
0
   void LoadFiltersFromGlobalString( const IsoString& globalKey )
   {
      filters.Clear();

      String s = PixInsightSettings::GlobalString( globalKey  );
      if ( !s.IsEmpty() )
      {
         for ( size_type p = 0; ; )
         {
            size_type p1 = s.Find( '(', p );
            if ( p1 == String::notFound )
               break;

            size_type p2 = s.Find( ')', p1 );
            if ( p2 == String::notFound )
               break;

            String extStr = s.Substring( p1, p2-p1 );
            if ( !extStr.IsEmpty() )
            {
               StringList extLst;
               extStr.Break( extLst, ' ', true );
               if ( !extLst.IsEmpty() )
               {
                  FileFilter filter;

                  for ( StringList::const_iterator i = extLst.Begin(); i != extLst.End(); ++i )
                  {
                     size_type d = i->Find( '.' );
                     if ( d != String::notFound )
                        filter.AddExtension( i->Substring( d ) );
                  }

                  if ( !filter.Extensions().IsEmpty() )
                  {
                     String desc = s.Substring( p, p1-p );
                     desc.Trim();
                     filter.SetDescription( desc );

                     filters.Add( filter );
                  }
               }
            }

            p = p2 + 1;
         }
      }
   }
Exemplo n.º 3
0
void MainWindow::init()
{
    m_CompressionInput.set_digits(0);
    m_CompressionInput.set_value(9);
    m_FileChooserButton.set_size_request(336);
    m_ProgressBar.set_size_request(-1, 30);
    m_CompressionRateBar.set_size_request(-1, 20);
    m_StartButton.set_sensitive(false);
    
    FileFilter fileFilter;
    fileFilter.add_pattern("*.iso");
    fileFilter.add_pattern("*.cso");
    m_FileChooserButton.set_filter(fileFilter);
        
    m_Layout.attach(m_FileChooserButton, 0, 2, 0, 1, FILL, EXPAND);
    m_Layout.attach(m_CompressionLabel, 0, 1, 1, 2, FILL, FILL);
    m_Layout.attach(m_CompressionInput, 1, 2, 1, 2, FILL, EXPAND);
    m_Layout.attach(m_ProgressBar, 0, 2, 2, 3, FILL, EXPAND);
    m_Layout.attach(m_CompressionRateBar, 0, 2, 3, 4, FILL, EXPAND);
    m_Layout.attach(m_StartButton, 1, 2, 4, 5, FILL, FILL);
}
Exemplo n.º 4
0
void StarGeneratorInterface::__Button_Clicked( Button& sender, bool checked )
{
   if ( sender == GUI->StarDatabase_ToolButton )
   {
      OpenFileDialog d;
      d.DisableMultipleSelections();
      d.SetCaption( "StarGenerator: Select Star Database File" );
      if ( d.Execute() )
      {
         instance.starDatabasePath = d.FileName();
         GUI->StarDatabase_Edit.SetText( instance.starDatabasePath );
      }
   }
   else if ( sender == GUI->OutputFile_ToolButton )
   {
      SaveFileDialog d;
      d.SetCaption( "StarGenerator: Select Output CSV File" );
      d.EnableOverwritePrompt();

      FileFilter csvFilter;
      csvFilter.SetDescription( "CSV Text Files" );
      csvFilter.AddExtension( ".csv" );
      d.Filters().Add( csvFilter );
      FileFilter allFilter;
      allFilter.SetDescription( "Any Files" );
      allFilter.AddExtension( "*" );
      d.Filters().Add( allFilter );

      if ( d.Execute() )
      {
         instance.outputFilePath = d.FileName();
         GUI->OutputFile_Edit.SetText( instance.outputFilePath );
      }
   }
   else if ( sender == GUI->DecSouth_CheckBox )
   {
      if ( checked != (instance.centerDec < 0) )
      {
         instance.centerDec = -instance.centerDec;
         UpdateDecControls();
      }
   }
   else if ( sender == GUI->Nonlinear_CheckBox )
   {
      instance.nonlinear = checked;
      UpdateControls();
   }
}
Exemplo n.º 5
0
int main() 
{

	int choice;	
	ifstream inValue; 
	ofstream outValue;
	string inputFile, outputFile;
	
	cout << "Please enter the name of the first input file: ";
	cin  >>inputFile;

	cout << "Please enter the name of the output file: ";
	cin  >>outputFile;



		cout << "\n 		Please make a selection						\n\n";
		cout << "1. Create an unchanged copy\n";
		cout << "2. Encrypt message\n";
		cout << "3. Transform message to uppercase letters\n";
		cout << "4. Special\n"; 
		cout << "5. Exit\n";
		cin  >> choice; 

			if (choice == 1)
				//create an unchanged copy
			{
				Copy cpyObj;
				FileFilter *ff = &cpyObj;
				ff->doFilter(inValue, outValue, inputFile, outputFile);
			}
			else if(choice == 2)
				//Encrypt message
			{
				Encrypt encObj;
				FileFilter *ff = &encObj;
				ff->doFilter(inValue, outValue, inputFile, outputFile);
			}
			else if(choice == 3)
				//Transform to uppercase
			{
				Transform transObj;
				FileFilter *ff = &transObj;
				ff->doFilter(inValue, outValue, inputFile, outputFile);
			}
			else if (choice == 4)
				//Special 
			{
				Special specObj;
				FileFilter *ff = &specObj;
				ff->doFilter(inValue, outValue, inputFile, outputFile);
			}
			else if ((choice < 1)||(choice > 5))
			{
				cout << "The valid choices were 1-4\n" << endl;
			}



	return 0;
}
Exemplo n.º 6
0
main (int argc, char *argv[])
{
   FileFilter<TestFFData> ff;

      // add data to the filter
   ff.addData(TestFFData(1));
   ff.addData(TestFFData(2));
   ff.addData(TestFFData(2));
   ff.addData(TestFFData(2));
   ff.addData(TestFFData(4));
   ff.addData(TestFFData(4));
   ff.addData(TestFFData(5));
   ff.addData(TestFFData(3));
   ff.addData(TestFFData(3));
   ff.addData(TestFFData(1));

      // do various operations on the data

   list<TestFFData>::iterator itr;

   cout << "unsorted" << endl;
   for(itr = ff.begin(); itr != ff.end(); itr++)
      (*itr).dump(cout << ' '); cout << endl;

   cout << "sorted" << endl;
   ff.sort(TestOperatorLessThan());
   for(itr = ff.begin(); itr != ff.end(); itr++)
      (*itr).dump(cout << ' '); cout << endl;

   cout << "filter out values > 3" << endl;
   ff.filter(TestRangeFilter(1,3));
   for(itr = ff.begin(); itr != ff.end(); itr++)
      (*itr).dump(cout << ' '); cout << endl;

   cout << "filter out 2" << endl;
   ff.filter(TestValueFilter(2));
   for(itr = ff.begin(); itr != ff.end(); itr++)
      (*itr).dump(cout << ' '); cout << endl;

   cout << "unique only" << endl;
   ff.unique(TestOperatorEquals());
   for(itr = ff.begin(); itr != ff.end(); itr++)
      (*itr).dump(cout << ' '); cout << endl;
}
void DrizzleIntegrationInterface::__Click( Button& sender, bool checked )
{
   if ( sender == GUI->AddFiles_PushButton )
   {
      FileFilter drzFiles;
      drzFiles.SetDescription( "Drizzle Data Files" );
      drzFiles.AddExtension( ".drz" );

      OpenFileDialog d;
      d.EnableMultipleSelections();
      d.Filters().Clear();
      d.Filters().Add( drzFiles );
      d.SetCaption( "DrizzleIntegration: Select Drizzle Data Files" );
      if ( d.Execute() )
      {
         size_type i0 = TreeInsertionIndex( GUI->InputData_TreeBox );
         for ( StringList::const_iterator i = d.FileNames().Begin(); i != d.FileNames().End(); ++i )
            m_instance.p_inputData.Insert( m_instance.p_inputData.At( i0++ ), DrizzleIntegrationInstance::DataItem( *i ) );
         UpdateInputDataList();
         UpdateDataSelectionButtons();
      }
   }
   else if ( sender == GUI->SelectAll_PushButton )
   {
      GUI->InputData_TreeBox.SelectAllNodes();
      UpdateDataSelectionButtons();
   }
   else if ( sender == GUI->InvertSelection_PushButton )
   {
      for ( int i = 0, n = GUI->InputData_TreeBox.NumberOfChildren(); i < n; ++i )
         GUI->InputData_TreeBox[i]->Select( !GUI->InputData_TreeBox[i]->IsSelected() );
      UpdateDataSelectionButtons();
   }
   else if ( sender == GUI->ToggleSelected_PushButton )
   {
      for ( int i = 0, n = GUI->InputData_TreeBox.NumberOfChildren(); i < n; ++i )
         if ( GUI->InputData_TreeBox[i]->IsSelected() )
            m_instance.p_inputData[i].enabled = !m_instance.p_inputData[i].enabled;
      UpdateInputDataList();
      UpdateDataSelectionButtons();
   }
   else if ( sender == GUI->RemoveSelected_PushButton )
   {
      DrizzleIntegrationInstance::input_data_list newImages;
      for ( int i = 0, n = GUI->InputData_TreeBox.NumberOfChildren(); i < n; ++i )
         if ( !GUI->InputData_TreeBox[i]->IsSelected() )
            newImages.Add( m_instance.p_inputData[i] );
      m_instance.p_inputData = newImages;
      UpdateInputDataList();
      UpdateDataSelectionButtons();
   }
   else if ( sender == GUI->Clear_PushButton )
   {
      m_instance.p_inputData.Clear();
      UpdateInputDataList();
      UpdateDataSelectionButtons();
   }
   else if ( sender == GUI->FullPaths_CheckBox )
   {
      UpdateInputDataList();
      UpdateDataSelectionButtons();
   }
   else if ( sender == GUI->InputDirectory_ToolButton )
   {
      GetDirectoryDialog d;
      d.SetCaption( "DrizzleIntegration: Select Input Directory" );
      if ( d.Execute() )
         GUI->InputDirectory_Edit.SetText( m_instance.p_inputDirectory = d.Directory() );
   }
   else if ( sender == GUI->EnableRejection_CheckBox )
   {
      m_instance.p_enableRejection = checked;
   }
   else if ( sender == GUI->EnableImageWeighting_CheckBox )
   {
      m_instance.p_enableImageWeighting = checked;
   }
   else if ( sender == GUI->EnableSurfaceSplines_CheckBox )
   {
      m_instance.p_enableSurfaceSplines = checked;
   }
   else if ( sender == GUI->ClosePreviousImages_CheckBox )
   {
      m_instance.p_closePreviousImages = checked;
   }
   else if ( sender == GUI->SelectPreview_Button )
   {
      PreviewSelectionDialog d;
      if ( d.Execute() )
         if ( !d.Id().IsEmpty() )
         {
            View view = View::ViewById( d.Id() );
            if ( !view.IsNull() )
            {
               m_instance.p_roi = view.Window().PreviewRect( view.Id() );
               UpdateROIControls();
            }
         }
   }
}