- Main Page
- Classes
- Files

- File List

# OptFrame/Parallel/MapReduce++/util/Scanner++/Scanner.h

    00001 // Scanner Object - Scanner++
    00002
    00003 // Copyright (C) 2009
    00004 // Igor Machado - Mario Henrique Perche - Pablo Munhoz - Sabir Ribas
    00005 //
    00006 // This file is part of the Scanner++ Library v0.91.  This library is free
    00007 // software; you can redistribute it and/or modify it under the
    00008 // terms of the GNU Lesser General Public License v3 as published by the
    00009 // Free Software Foundation.
    00010
    00011 // This library is distributed in the hope that it will be useful,
    00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
    00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00014 // GNU Lesser General Public License v3 for more details.
    00015
    00016 // You should have received a copy of the GNU Lesser General Public License v3
    00017 // along with this library; see the file COPYING.  If not, write to the Free
    00018 // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
    00019 // USA.
    00020
    00021 #ifndef SCANNERPP_H_
    00022 #define SCANNERPP_H_
    00023
    00024
    00025 #include<iostream>
    00026 #include<istream>
    00027 #include<string>
    00028 #include<sstream>
    00029
    00030 #include<vector>
    00031
    00032 #include <stdlib.h>
    00033
    00034 using namespace std;
    00035
    00036 #include "File.h"
    00037
    00038 class Scanner
    00039 {
    00040 private:
    00041         istream *input;
    00042
    00043         File* inputfile;
    00044
    00045         bool hasNextChar();
    00046         char nextChar();
    00047
    00048         string sep;
    00049
    00050 public:
    00051         Scanner(File* inputfile);
    00052         Scanner(istream* input);
    00053         Scanner(string input);
    00054
    00055         virtual ~Scanner();
    00056
    00057         // useDefaultSeparators: chama o useSeparators para os caracteres:
    00058         // espaco, quebra de linha (\n), tabulacao (\t) e retorno de carro (\r)
    00059
    00060         void useDefaultSeparators();
    00061
    00062         // useSeparators: equivalente ao useDelimiter de Java
    00063         // a diferenca e que Java trata a string como uma
    00064         // expressao regular, e neste caso o useSeparators
    00065         // apenas considera cada caractere da string separadamente
    00066         // como um separador.
    00067
    00068         void useSeparators(string s);
    00069         bool inSeparators(char c);
    00070
    00071         std::string next();
    00072         std::string nextLine();
    00073         int nextInt();
    00074         long nextLong();
    00075         float nextFloat();
    00076         double nextDouble();
    00077
    00078         bool hasNext();
    00079         bool hasNextLine(); // Unimplemented! Calling hasNext() instead
    00080         bool hasNextInt(){return true;}
    00081         bool hasNextLong(){return true;}
    00082         bool hasNextFloat(){return true;}
    00083         bool hasNextDouble(){return true;}
    00084
    00085         void close();
    00086 };
    00087
    00088 #endif /*SCANNERPP_H_*/

All Classes Functions