Files
NazaraEngine/include/Nazara/Core/File.hpp
Lynix 70ef422950 Big skeletal animation update
Added MeshInfos demo
Added MD5Mesh/MD5Anim loader support
Added Node class
Fixed ResourceParams not being exported
Added support for skeletal animation
(Animation/Mesh/Joint/SkeletalMesh/Skeleton)
Meshes are now only stored with VertexStruct_XYZ_Normal_UV_Tangent type
Moved Sequence declaration to Sequence.hpp

-Animation:
Renamed Create to Create[Keyframe|Skeletal]

-AxisAlignedBox:
Added Contains method
Added GetCorner method
Added GetCube method
Added Transform method

-Cube/Rect:
Added GetPosition method
Added GetSize method
(Almost) Fixed ExtendTo method
Fixed GetCenter method

-File:
Added GetDirectory static function
Added GetPath method
Renamed GetDirectoryPath method to GetDirectory

-Math module:
Fixed constructor/methods taking a non-const array
GetNormal/Normalize methods now takes an optionnal integer pointer
(returning length)
Made all classes default constructor trivial
Inverse, MakeIdentity, MakeZero, Normalize, Set methods now returns
reference to object

-Matrix4:
Modified methods to avoid copies
Removed COW (Too much overhead)
Removed Concatenate[Affine] static function

-Mesh:
Renamed Create to Create[Keyframe|Skeletal|Static]
Renamed Skin to Material

-MeshParams:
No longer takes declaration argument
Renamed loadAnimations to animated
Storage default to BufferStorage_Hardware if supported and
BufferStorage_Software otherwise

-OpenGL:
Added glGetBooleanv function
Added glIsEnabled function

-Quaternion:
Added ComputeW method
Added Conjugate method

-Renderer:
Added IsEnabled static function
Fixed GetLineWidth function not being static
Removed SetVertexDeclaration

-RenderWindow:
Made CopyTo[Image|Texture] method constant

-Resource
Fixed RemoveResourceListener crash

-ResourceLoader:
Loaders are now used in a LIFO context

-Stream:
Renamed GetLine method to ReadLine

-String:
Fixed Simplified

-Utility module
Added configuration define for strict resource parsing

-VertexBuffer
Now takes a VertexDeclaration pointer

-VertexDeclaration
No longer throw an error when getting a non-existing element


Former-commit-id: f7358c1231d6af48b799d2f24f077a001e16785b
2012-11-21 19:20:32 +01:00

125 lines
3.9 KiB
C++

// Copyright (C) 2012 Jérôme Leclercq
// This file is part of the "Nazara Engine - Core module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
#ifndef NAZARA_FILE_HPP
#define NAZARA_FILE_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/Directory.hpp>
#include <Nazara/Core/Endianness.hpp>
#include <Nazara/Core/Hashable.hpp>
#include <Nazara/Core/HashDigest.hpp>
#include <Nazara/Core/InputStream.hpp>
#include <Nazara/Core/NonCopyable.hpp>
#include <Nazara/Core/String.hpp>
#if NAZARA_CORE_THREADSAFE && NAZARA_THREADSAFETY_FILE
#include <Nazara/Core/ThreadSafety.hpp>
#else
#include <Nazara/Core/ThreadSafetyOff.hpp>
#endif
class NzFileImpl;
class NAZARA_API NzFile : public NzHashable, public NzInputStream, NzNonCopyable
{
public:
enum CursorPosition
{
AtBegin, // Début du fichier
AtCurrent, // Position du pointeur
AtEnd // Fin du fichier
};
enum OpenMode
{
Current = 0x00, // Utilise le mode d'ouverture actuel
Append = 0x01, // Empêche l'écriture sur la partie déjà existante et met le curseur à la fin
Lock = 0x02, // Empêche le fichier d'être modifié tant qu'il est ouvert
ReadOnly = 0x04, // Ouvre uniquement en lecture
ReadWrite = 0x08, // Ouvre en lecture/écriture
Text = 0x10, // Ouvre en mode texte
Truncate = 0x20, // Créé le fichier s'il n'existe pas et le vide s'il existe
WriteOnly = 0x40 // Ouvre uniquement en écriture, créé le fichier s'il n'existe pas
};
NzFile();
NzFile(const NzString& filePath);
NzFile(const NzString& filePath, unsigned long openMode);
NzFile(NzFile&& file) noexcept;
~NzFile();
bool Copy(const NzString& newFilePath);
void Close();
bool Delete();
bool EndOfFile() const;
bool EndOfStream() const;
bool Exists() const;
void Flush();
time_t GetCreationTime() const;
nzUInt64 GetCursorPos() const;
NzString GetDirectory() const;
NzString GetFileName() const;
time_t GetLastAccessTime() const;
time_t GetLastWriteTime() const;
NzString GetPath() const;
nzUInt64 GetSize() const;
bool IsOpen() const;
bool Open(unsigned long openMode = Current);
std::size_t Read(void* buffer, std::size_t size);
std::size_t Read(void* buffer, std::size_t typeSize, unsigned int count);
bool Rename(const NzString& newFilePath);
bool SetCursorPos(CursorPosition pos, nzInt64 offset = 0);
bool SetCursorPos(nzUInt64 offset);
void SetEndianness(nzEndianness endianness);
bool SetFile(const NzString& filePath);
bool SetOpenMode(unsigned int openMode);
bool Write(const NzString& string);
std::size_t Write(const void* buffer, std::size_t typeSize, unsigned int count);
NzFile& operator=(const NzString& filePath);
NzFile& operator=(NzFile&& file) noexcept;
static NzString AbsolutePath(const NzString& filePath);
static bool Copy(const NzString& sourcePath, const NzString& targetPath);
static bool Delete(const NzString& filePath);
static bool Exists(const NzString& filePath);
static time_t GetCreationTime(const NzString& filePath);
static NzString GetDirectory(const NzString& filePath);
static time_t GetLastAccessTime(const NzString& filePath);
static time_t GetLastWriteTime(const NzString& filePath);
static NzHashDigest GetHash(const NzString& filePath, nzHash hash);
static NzHashDigest GetHash(const NzString& filePath, NzHashImpl* hash);
static nzUInt64 GetSize(const NzString& filePath);
static bool IsAbsolute(const NzString& filePath);
static NzString NormalizePath(const NzString& filePath);
static NzString NormalizeSeparators(const NzString& filePath);
static bool Rename(const NzString& sourcePath, const NzString& targetPath);
private:
bool FillHash(NzHashImpl* hash) const;
NazaraMutexAttrib(m_mutex, mutable)
nzEndianness m_endianness;
NzString m_filePath;
NzFileImpl* m_impl;
unsigned int m_openMode;
};
#endif // NAZARA_FILE_HPP