Main Page - Header
Author: The Inti Development Team

Reference Manual

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# fileutils.h

Go to the documentation of this file.

    00001 /*  Inti: Integrated Foundation Classes
    00002  *  Copyright (C) 2003 The Inti Development Team.
    00003  *
    00004  *  This program is free software; you can redistribute it and/or modify
    00005  *  it under the terms of the GNU General Public License as published by
    00006  *  the Free Software Foundation; either version 2 of the License, or
    00007  *  (at your option) any later version.
    00008  *
    00009  *  This program is distributed in the hope that it will be useful,
    00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00012  *  GNU Library General Public License for more details.
    00013  *
    00014  *  You should have received a copy of the GNU Library General Public License
    00015  *  along with this program; if not, write to the Free Software
    00016  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    00017  */
    00018
    00021
    00022 #ifndef INTI_G_FILEUTILS_H
    00023 #define INTI_G_FILEUTILS_H
    00024
    00025 #ifndef INTI_STACK_OBJECT_H
    00026 #include <inti/stackobject.h>
    00027 #endif
    00028
    00029 #ifndef INTI_UTF_STRING_H
    00030 #include <inti/utf-string.h>
    00031 #endif
    00032
    00033 #ifndef __G_DIR_H__
    00034 #include <glib/gdir.h>
    00035 #endif
    00036
    00037 #ifndef __G_FILEUTILS_H__
    00038 #include <glib/gfileutils.h>
    00039 #endif
    00040
    00041 #ifndef _CPP_VECTOR
    00042 #include <vector>
    00043 #endif
    00044
    00045 namespace Inti {
    00046
    00047 namespace G {
    00048
    00049 class Error;
    00050
    00053
    00054 enum FileTest
    00055 {
    00056         FILE_TEST_IS_REGULAR = G_FILE_TEST_IS_REGULAR,
    00058
    00059         FILE_TEST_IS_SYMLINK = G_FILE_TEST_IS_SYMLINK,
    00061
    00062         FILE_TEST_IS_DIR = G_FILE_TEST_IS_DIR,
    00064
    00065         FILE_TEST_IS_EXECUTABLE = G_FILE_TEST_IS_EXECUTABLE,
    00067
    00068         FILE_TEST_EXISTS = G_FILE_TEST_EXISTS
    00070 };
    00071
    00073
    00074 typedef unsigned int FileTestField;
    00075
    00078
    00079 GFileError file_error_from_errno(int err_no);
    00089
    00090 bool file_test(const std::string& filename, FileTestField test);
    00129
    00130 bool file_get_contents(const std::string& filename, std::string& contents, G::Error *error);
    00140
    00142
    00180
    00181 class TempFile : public StackObject
    00182 {
    00183         TempFile(const TempFile&);
    00184         TempFile& operator=(const TempFile&);
    00185
    00186         int file_descriptor_;
    00187
    00188 public:
    00191
    00192         TempFile();
    00194
    00195         TempFile(std::string& template_filename);
    00200
    00201         TempFile(const std::string& template_filename, std::string& actual_filename, G::Error *error);
    00208
    00209         ~TempFile();
    00211
    00215
    00216         bool is_open() const;
    00219
    00223
    00224         bool open(std::string& actual_filename, G::Error *error);
    00231
    00232         bool open(const std::string& template_filename, std::string& actual_filename, G::Error *error);
    00250
    00251         bool mkstemp(std::string& template_filename);
    00264
    00265         bool close();
    00267
    00269 };
    00270
    00312
    00313 class Dir : public StackObject
    00314 {
    00315         Dir(const Dir&);
    00316         Dir& operator=(const Dir&);
    00317
    00318         GDir *dir_;
    00319
    00320 public:
    00323
    00324         Dir();
    00326
    00327         Dir(const char *path, G::Error *error);
    00335
    00336         Dir(const std::string& path, G::Error *error);
    00344
    00345         ~Dir();
    00348
    00352
    00353         bool is_open() const;
    00356
    00360
    00361         bool open(const char *path, G::Error *error);
    00371
    00372         const char* read_name();
    00378
    00379         int read_names(std::vector<String>& names);
    00391
    00392         void rewind();
    00395
    00396         void close();
    00398
    00400 };
    00401
    00402 } // namespace G
    00403
    00404 } // namespace Inti
    00405
    00406 #endif // INTI_G_FILEUTILS_H
    00407
    00408
    00409
    00410
    00411
    00412
    00413
    00414
    00415
    00416
    00417
    00418
    00419
    00420

Main Page - Footer