Teamcenter C++ API Reference  2312
OSFile.hxx
Go to the documentation of this file.
1 /*==================================================================================================
2 
3 Copyright (c) 2013 Siemens PLM
4 Unpublished - All rights reserved
5 
6  ====================================================================================================*/
17 #ifndef FCLASSES_OSFILE_INCLUDE_HXX
18 #define FCLASSES_OSFILE_INCLUDE_HXX
19 
26 #include <ss/ss_const.h>
27 #include <ss/ss_types.h>
28 
29 #include <fclasses/libfclasses_exports.h>
30 namespace Teamcenter
31 {
37  class FCLASSES_API OSFile
38  {
39  public:
45  OSFile(const char *iFilePath, int iFileType = SS_TEXT);
46 
51  OSFile(int iFileType = SS_TEXT);
52 
57  OSFile(const OSFile& iOSFile);
58 
62  OSFile& operator = (const OSFile&);
63 
67  virtual ~OSFile();
68 
69 
80  static char *getValidatedFileName(const char *iFileNameToValidate, bool iKeepCase);
81 
93  static char *getCleanedName(const char *iFileNameToClean);
94 
95 
102  char* getFilePath() const;
103 
110  char* getFileName() const;
111 
118  char *getFileExtension() const;
119 
127  char* getDirectoryPath() const;
128 
147  int rename( const char* iFileName );
148 
167  int changeFilePath( const char* iFilePath );
168 
181  int exists (bool& oFileExists) const;
182 
210  int create (int iMode = SS_DEF_FMODE);
211 
228  int open( int iRWMode = SS_RDONLY );
229 
242  int close();
243 
256  int chmod (int iMode);
257 
270  int getFileStatus( SS_file_status *oFileStatus );
271 
283  int getFileType(int *oFileType);
284 
288  int getFileSize();
289 
304  int copy( const char *iCopyPath );
305 
318  int deleteFile ();
319 
334  int print (const char *iPrinter = 0) const;
335 
351  int readLine( char* oReadLine );
352 
370  int readLineWithAllocation (char** oReadLine);
371 
391  int fscanf (const char * oFormattedLine, ...);
392 
409  int writeLine( const char* iLine );
410 
428  int fprintf (const char *iFormattedLine, ...);
429 
444  int initializeParsing();
445 
446 
488  char* getToken(char *oFoundSeparator, const char* iSeparators=" \n\t\r\f");
489 
490 
508  int seek( int* iOffset);
509 
527  int read (void *ioBuffer, int iNumberOfBytes, int iType = SS_VOID);
528 
537  int readVoid (void *ioBuffer, int iNumberOfBytes);
538  int readChar (unsigned char *ioBuffer, int iNumberOfBytes);
539  int readByte (unsigned char *ioBuffer, int iNumberOfBytes);
540  int readShort (unsigned short *ioBuffer, int iNumberOfBytes);
541  int readShort (short *ioBuffer, int iNumberOfBytes);
542  int readInt (unsigned int *ioBuffer, int iNumberOfBytes);
543  int readInt (int *ioBuffer, int iNumberOfBytes);
544  int readLong (unsigned long *ioBuffer, int iNumberOfBytes);
545  int readLong (long *ioBuffer, int iNumberOfBytes);
546  int readFloat (float *ioBuffer, int iNumberOfBytes);
547  int readDouble(double *ioBuffer, int iNumberOfBytes);
569  int write (const void *ioBuffer, int iNumberOfBytes, int iType = SS_VOID);
570 
579  int writeVoid (const void *ioBuffer, int iNumberOfBytes);
580  int writeChar (const unsigned char *ioBuffer, int iNumberOfBytes);
581  int writeByte (const unsigned char *ioBuffer, int iNumberOfBytes);
582  int writeShort (const unsigned short *ioBuffer, int iNumberOfBytes);
583  int writeShort (const short *ioBuffer, int iNumberOfBytes);
584  int writeInt (const unsigned int *ioBuffer, int iNumberOfBytes);
585  int writeInt (const int *ioBuffer, int iNumberOfBytes);
586  int writeLong (const unsigned long *ioBuffer, int iNumberOfBytes);
587  int writeLong (const long *ioBuffer, int iNumberOfBytes);
588  int writeFloat (const float *ioBuffer, int iNumberOfBytes);
589  int writeDouble (const double *ioBuffer, int iNumberOfBytes);
598  OSFile& operator >> (unsigned char&);
599  OSFile& operator >> (short&);
600  OSFile& operator >> (unsigned short&);
601  OSFile& operator >> (int&);
602  OSFile& operator >> (unsigned int&);
603  OSFile& operator >> (long&);
604  OSFile& operator >> (unsigned long&);
605  OSFile& operator >> (float&);
606  OSFile& operator >> (double&);
615  OSFile& operator << (unsigned char);
616  OSFile& operator << (short);
617  OSFile& operator << (unsigned short);
618  OSFile& operator << (int);
619  OSFile& operator << (unsigned int);
620  OSFile& operator << (long);
621  OSFile& operator << (unsigned long);
622  OSFile& operator << (float);
623  OSFile& operator << (double);
635  virtual char *asString() const;
636 
637 
638  protected:
642  bool isSeparator(char iCharacter, const char *iSeparators) const;
643 
644 
645  private:
647  void getFileInformation();
648 
650  int m_owner;
651 
654 
657 
660 
663 
666 
669 
672 
675 
678 
681 
684 
686  char* m_filePath;
687 
689  struct
690  {
692  const char* operation;
693  } m_fileStatus;
694 
696  static const char* OPERATION_CONSTRUCTOR;
697  static const char* OPERATION_COPYCONST;
698  static const char* OPERATION_OPERATOREQUALS;
699  static const char* OPERATION_RENAME;
700  static const char* OPERATION_CHANGEFP;
701  static const char* OPERATION_CREATE;
702  static const char* OPERATION_OPEN;
703  static const char* OPERATION_CLOSE;
704  static const char* OPERATION_DELETE;
705  static const char* OPERATION_EXISTS;
706  static const char* OPERATION_CHMOD;
707  static const char* OPERATION_STAT;
708  static const char* OPERATION_COPY;
709  static const char* OPERATION_READ;
710  static const char* OPERATION_WRITE;
711  static const char* OPERATION_FPRINTF;
712  static const char* OPERATION_FSCANF;
713  static const char* OPERATION_READLINEWA;
714  static const char* OPERATION_READLINE;
715  static const char* OPERATION_WRITELINE;
716  static const char* OPERATION_SEEK;
717  static const char* OPERATION_GETFILEINFO;
718  };
719 }
720 
721 #include <fclasses/libfclasses_undef.h>
722 #endif