Top > C++ > apcl > file

File Edit

Version:revision 6

fileFile.hpp
Everything is expanded.Everything is shortened.
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 
 
 
 
 
 
 
 
 
 
 
 
-
-
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
!
|
!
 
 
 
/** 
 * @file 
 * t@CNXLqB 
 */
#pragma once
 
//-----------------------------------------------------------
#include <apcl/file/FileType.hpp>
#include <apcl/file/FilePath.hpp>
#include <apcl/util/Data.hpp>
 
//-----------------------------------------------------------
namespace apcl { namespace file
{
    using ::apcl::util::Data;
 
    /// t@CNX
    class File
    {
    public:
        //=================================================
        /// @name Ej
        //@{
        File();
        virtual ~File();
        //@}
 
        //=================================================
        /// @name t@CpX
        //@{
        /// t@CpX擾B
        const FilePath& path()const;
        /// t@CpXݒ肷B
        void setPath( const FilePath& );
        //@}
 
        //=================================================
        /// @name f[^
        //@{
        /// f[^擾B
        const Data& data()const;
        /// f[^ݒ肷B
        void setData( const Data& );
        //@}
 
        //=================================================
        /// @name t@C^Cv
        //@{
        /// t@C^Cv擾B
        FileType type()const;
        /// t@C^Cvݒ肷B
        void setType( FileType );
        //@}
 
    private:
        FilePath path_;
        Data data_;
        FileType type_;
    };
 
}} // end of namespace ::apcl::file
 
//-----------------------------------------------------------
// EOF
fileFile.cpp
Everything is expanded.Everything is shortened.
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 
 
 
 
 
 
 
 
 
 
 
 
-
!
 
 
 
-
!
 
 
 
-
|
!
 
 
 
-
|
!
 
 
 
-
|
!
 
 
 
-
|
!
 
 
 
-
|
!
 
 
 
-
|
!
/** @file @brief File.hpp̎LqB */
#include <apcl/file/File.hpp>
 
//-----------------------------------------------------------
 
 
//-----------------------------------------------------------
using namespace ::apcl::file;
 
//-----------------------------------------------------------
File::File():
type_( FileType_Binary )
{
}
 
//-----------------------------------------------------------
File::~File()
{
}
 
//-----------------------------------------------------------
const FilePath& File::path()const
{
    return path_;
}
 
//-----------------------------------------------------------
void File::setPath( const FilePath& aPath )
{
    path_ = aPath;
}
 
//-----------------------------------------------------------
const Data& File::data()const
{
    return data_;
}    
 
//-----------------------------------------------------------
void File::setData( const Data& aData )
{
    data_ = aData;
}
 
//-----------------------------------------------------------
FileType File::type()const
{
    return type_;
}
 
//-----------------------------------------------------------
void File::setType( const FileType aType )
{
    type_ = aType;
}

FilePath Edit

Version:revision 6

fileFilePath.hpp
Everything is expanded.Everything is shortened.
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 
 
 
 
 
 
 
-
-
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
|
|
!
|
!
!
/** @file @brief t@CpXNXLqB */
#pragma once
 
//-----------------------------------------------------------
#include <string>
 
//-----------------------------------------------------------
namespace apcl { namespace file
{
    using ::std::string;
 
    /**
	 * t@CpXNX
	 * <pre>
	 * fBNg̓XbVŋ؂B
	 * </pre>
	 */
    class FilePath
    {
    public:
        FilePath();
        virtual ~FilePath();
 
        /// t@CpXݒ肷B
        void setPath( const string& aFilePath );
 
        /// t@CpX擾B
        const string& path()const;
 
    private:
        string path_;
    };
 
} // end of namespace file
} // end of namespace apcl
fileFilePath.cpp
Everything is expanded.Everything is shortened.
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 
 
 
 
 
 
 
 
-
!
 
 
 
-
!
 
 
 
-
|
!
 
 
 
-
|
!
/** @file @brief FilePath.hpp̎LqB */
#include <apcl/file/FilePath.hpp>
 
//-----------------------------------------------------------
using namespace ::apcl::file;
 
//-----------------------------------------------------------
FilePath::FilePath()
{
}
 
//-----------------------------------------------------------
FilePath::~FilePath()
{
}
 
//-----------------------------------------------------------
void FilePath::setPath( const string& aPath )
{
    path_ = aPath;
}
 
//-----------------------------------------------------------
const string& FilePath::path()const
{
    return path_;
}

FileSaver Edit

Version:revision 6

fileFileSaver.hpp
Everything is expanded.Everything is shortened.
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 
 
 
 
 
 
 
-
-
|
|
-
|
|
|
|
|
|
|
|
|
|
|
|
!
|
!
!
/** @file @brief t@CۑNXLqB */
#pragma once
 
//-----------------------------------------------------------
#include <apcl/file/File.hpp>
 
//-----------------------------------------------------------
namespace apcl { namespace file
{
    /// t@CۑNX
    class FileSaver
    {
    public:
        FileSaver( const File& ); ///< ۑt@Cw肷B
        virtual ~FileSaver();
 
        /// ۑt@C擾B
        const File& file()const;
 
        /// ۑBtrueB
        bool save()const;
 
    private:
        const File file_;
    };
 
} // end of namespace file
} // end of namespace apcl
fileFileSaver.cpp
Everything is expanded.Everything is shortened.
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
-
!
 
 
 
-
!
 
 
 
-
|
!
 
 
 
-
|
|
|
|
|
|
|
|
-
|
!
|
|
|
|
|
|
|
|
!
/** @file @brief FileSaver.hpp ̎LqB */
#include <apcl/file/FileSaver.hpp>
 
//-----------------------------------------------------------
#include <apcl/file/File.hpp>
#include <apcl/file/FilePath.hpp>
#include <apcl/util/Data.hpp>
#include <fstream>
 
//-----------------------------------------------------------
using namespace ::apcl::file;
using namespace ::apcl::util;
 
//-----------------------------------------------------------
FileSaver::FileSaver( const File& aFile ):
file_( aFile )
{
}
 
//-----------------------------------------------------------
FileSaver::~FileSaver()
{
}
 
//-----------------------------------------------------------
const File& FileSaver::file()const
{
    return file_;
}
 
//-----------------------------------------------------------
bool FileSaver::save()const
{
    //---I[v[h̐ݒ
    std::ios_base::open_mode mode = std::ios_base::out;
    if ( file_.type() == FileType_Binary )
        mode |= std::ios::binary;
 
    //---CvbgXg[̍쐬
    std::ofstream    out( file_.path().path().c_str() , mode  );
    if ( !out.is_open() )
    {//---t@CI[vɎs
        return false;
    }
 
    //---t@Co
    out.write( reinterpret_cast<const char*>( file_.data().bytes() ) , file_.data().length() );
 
    //---Xg[‚
    out.close();    
 
    return true;
}

FileType Edit

Version:revision 6

fileFileType.hpp
Everything is expanded.Everything is shortened.
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 
 
 
 
-
-
|
|
-
|
|
|
|
|
!
|
!
!
/** @file @brief t@C^CvʎqLqB */
#pragma once
 
//-----------------------------------------------------------
namespace apcl { namespace file 
{
    /// t@C^Cvʎq
    enum FileType
    {
        FileType_Binary = 0 , ///< oCi
        FileType_Ascii , ///< AXL[
        FileType_Terminate,
        FileType_Begin = 0 ,
        FileType_End = FileType_Terminate
    };
 
} // end of namespace file
} // end of namespace apcl
fileFileType.cpp
Everything is expanded.Everything is shortened.
  1
  2
 
 
/** @file @brief FileType.hpp ̎LqB */
#include <apcl/file/FileType.hpp>

Attach file: fileFile.hpp 573 download [Information] fileFileType.hpp 547 download [Information] fileFileType.cpp 517 download [Information] fileFileSaver.cpp 604 download [Information] fileFileSaver.hpp 577 download [Information] fileFilePath.hpp 514 download [Information] fileFilePath.cpp 508 download [Information] fileFileLoader.cpp 249 download [Information] fileFileLoader.hpp 254 download [Information] fileFile.cpp 552 download [Information]

Reload   New Lower page making Edit Freeze Diff Upload Copy Rename   Front page List of pages Search Recent changes Backup Referer   Help   RSS of recent changes
Last-modified: (5879d)