Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Austrian Coder

Problems with some headers

This topic is 5155 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi! I have here an header called n_fs.h - filesystem code, and a n_string.h - a sting class. In the n_fs.h i am using the String class. Now i want to add support to read and wirte strings from files. So i have made a new file n_tools.h/cpp. It looks like this: N_API void ReadString(N::CFile *File, N::String &str); N_API void WriteString(N::CFile *File, N::String &str); Now i get errors like: ..\n_tools.h(60): error: incomplete type is not allowed N_API void ReadString(N::CFile *File, Na::String &str); ^ ..\n_tools.h(60): error: namespace "Nesseia" has no member "CFile" N_API void ReadString(N::CFile *File, N::String &str); ^ ..\n_tools.h(60): error: identifier "File" is undefined N_API void ReadString(N::CFile *File, N::String &str); ^ ..\n_tools.h(60): error: expected a ")" N_API void ReadString(N::CFile *File, N::String &str); In the n_tools.h i have 2 namespaces: namespace N { namespace Tools { } } Where could be the mistake?

Share this post


Link to post
Share on other sites
Advertisement
Not realy. So i will post some more source

n_string.h:

#ifndef _STRING_H_
#define _STRING_H_

#include <sstream> // for stringstream
#include <string>
#include <algorithm> // for transform

#include "n_global.h" // platform.h

#ifdef USE_MMGR
# include "n_mmgr.h"
#endif /*USE_MMGR*/


#if USE_WCHAR_T_STRINGS
typedef std::wstring StringBase;
#else
typedef std::string StringBase;
#endif

namespace N
{
// ==================================
//! stringclass.
class N_API String : public StringBase
{
public:
// constructors
String() : StringBase() {}
String(const String& rhs) : StringBase(static_cast(rhs)) {}
String(const StringBase& rhs) : StringBase(rhs) {}
String(const char* rhs) : StringBase(rhs) {}

// very usefull operations
operator const char* () const { return c_str(); }
operator unsigned char* () const { return (unsigned char*)c_str(); }
operator char*() { return (char*)c_str(); }

// nice template
template String& operator << (T value)
{
// create stringstream based on *this contents
std::stringstream stream;
stream.str(*this);
// goto end
stream.seekp(0, std::ios_base::end);
// write
stream << value;
// assign back
*this = StringBase(stream.str());

return *this;
}

// string functions
inline String ToUpper();
inline String ToLower();
inline void Format(String Input, ...);
};
}

#endif /*_STRING_H_*/


n_fs.h:

#ifndef _FS_H_
#define _FS_H_

#include "n_global.h"
#include "n_fs_file.h"
#include "n_fs_file_pysical.h"
#include "n_fs_file_memory.h"
#include "n_exception.h"

#ifdef USE_MMGR
# include "n_mmgr.h"
#endif /*USE_MMGR*/

namespace N
{
// ==================================
class N_API CFile
{
public:
CFile(): m_FileInstance(0) {}
~CFile();

bool Open(String Filename, bool Readonly = true);

// some inlines
inline void Close();

inline size_t Read(void* buf, size_t size);
inline size_t Write(void* data, size_t size);

inline void Seek(long amout, MoveMethode methode);
inline void Flush();
inline bool Eof();

inline size_t Tell();
inline size_t GetSize();

protected:
IFile *m_FileInstance;
};
}

#endif /*_FS_H_*/


n_tools.h:

#ifndef _TOOLS_H_
#define _TOOLS_H_

#include "n_cpu.h"
#include "n_log.h"
//#include "n_fs.h" // if i uncomment this line, i get some errors

#ifdef USE_MMGR
# include "n_mmgr.h"
#endif /*USE_MMGR*/

namespace N
{
// ==================================
//! This namespace contains some nice stuff
namespace Tools
{

// strings and files
N_API void ReadString(N::CFile *File, N::String &str);
N_API void WriteString(N::CFile *File, N::String &str);
}
}

#endif /*_TOOLS_H_*/



[edited by - Austrian Coder on April 14, 2004 7:42:56 PM]

[edited by - Austrian Coder on April 14, 2004 7:43:39 PM]

Share this post


Link to post
Share on other sites
I can''t actually reproduce your error with what you have listed. Perhaps it''s an error in one of the header files included by the header files you posted?

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!