Cyclone 3DR Script
from Technodigit, part of Hexagon. Copyright 1997-2022.
 
Loading...
Searching...
No Matches
SFile.h
1
2
3
5
6#pragma once
7
8#include "RshPluginScript/RshPluginScriptDefines.h"
9#include "RshPluginScript/SClass/SObject.h"
10#include <QtCore/SFile>
11
12#ifndef FCT_DOC
13namespace rsh::ScriptBinding
14{
15#endif // !FCT_DOC
16
19class SFile : public SObject
20{
21 //======================================================================================================================
22 // INTERNAL FUNCTION
23 //======================================================================================================================
24
25 //======================================================================================================================
26 // DOCUMENTED FUNCTION
27 //======================================================================================================================
28public:
30 {
31 ReadOnly, // The file is open for reading.
32 WriteOnly, // The file is open for writing. Note that this mode implies Truncate.
33 ReadWrite, // The file is open for reading and writing.
34 Append, // The file is opened in append mode so that all data is written to the end of the file.
35 Truncate// If possible, the file is truncated before it is opened. All earlier contents of the device are lost.
36 };
37
38public slots: // these functions (slots) will be available in QtScript
41 Boolean Open(OpenModeEnum OpenMode);
44 Boolean IsOpen() ;
50 Boolean Exists();
54 Boolean AtEnd() ;
57 String FileName() ;
61 Boolean Remove();
65 Boolean Rename( String NewName);
68 String ReadAll();
71 String ReadLine();
75 Boolean Write( String ToWrite);
76
79 String toString() ;
80};
81
82// @brief
83// This class allows to wrap static functions to SXmlWriter easily.
84// This allow to wrap constructor more easily : the constructor will be declared with the function New(...)
85class SFile
86#ifndef FCT_DOC
87 : public SObjectStatic
88#endif // FCT_DOC
89{
90 //======================================================================================================================
91 // INTERNAL FUNCTION
92 //======================================================================================================================
93
94 //======================================================================================================================
95 // DOCUMENTED FUNCTION
96 //======================================================================================================================
97public slots:
100 // TESTED
101 static SFile New( String name);
102
106 static Boolean Remove( String fileName);
107
110 static String toString();
111};
112Q_DECLARE_METATYPE(SFile::_SFileDummy);
113Q_DECLARE_METATYPE(SFile);
114
115#ifndef FCT_DOC
116} // namespace rsh::ScriptBinding
117#endif // !FCT_DOC
118
119Q_DECLARE_METATYPE(SFile);
120Q_DECLARE_METATYPE(SFile);
The Sfile class provides an interface for reading from and writing to files.
Definition: SFile.h:20
OpenModeEnum
Definition: SFile.h:30
@ Append
Definition: SFile.h:34
@ WriteOnly
Definition: SFile.h:32
@ ReadWrite
Definition: SFile.h:33
@ ReadOnly
Definition: SFile.h:31
Boolean IsOpen()
Returns true if the file is open; otherwise returns false. A file is open if it can be read from and/...
String toString()
Get the type of the variable.
Boolean Write(String ToWrite)
Writes the content of string to the file. Returns true if successful; otherwise returns false if an e...
Boolean Remove()
Removes the file specified by the FileName(). Returns true if successful; otherwise returns false.
Boolean Open(OpenModeEnum OpenMode)
Opens the existing file (The file is always open in text mode). Returns true if successful; otherwise...
String ReadLine()
Reads a line from the file.
static String toString()
Get the type of the variable.
Boolean AtEnd()
Returns true if the current read and write position is at the end of the file (i.e....
String ReadAll()
Reads all available data from the file, and returns it as a string.
String FileName()
Return the name set by the SFile constructor.
static SFile New(String name)
Constructs a new file object to represent the file with the given name.
Close()
To close the file.
Boolean Rename(String NewName)
Renames the file currently specified by FileName() to NewName. Returns true if successful; otherwise ...
static Boolean Remove(String fileName)
Removes the file specified by the fileName given. Returns true if successful; otherwise returns false...
Boolean Exists()
To check if the file exists.
This class is an abstract class, you can use these function in its derived classes.
Definition: SObject.h:35