最近、ここに書いている階層ヘッダー ファイルについて質問しました。私は答えを得て、それを解決策としてマークしました。しかし、しばらくすると、このトピックについて追加の質問があります。ネストされた型はどうですか?タイプ階層のヘッダー ファイルに、ネストされたタイプも表示されるようにしたいと考えています。例 (TODO を読んでください):
/*
hierarchy.h
© Andrey Bushman, 12 July 2013
This file contains the full hierarchy of this application's types. This file
must be included into the each header file of this application.
*/
//-----------------------------------------------------------------------------
#ifndef BUSH_HIERARCHY_H
#define BUSH_HIERARCHY_H
#include <iostream>
#include <string>
#include <exception>
//*****************************************************************************
namespace Bushman{
//*****************************************************************************
namespace Common{
// run-time checked narrowing cast (type conversion)
template <class R, class A> inline R narrow_cast(const A& a);
// Throw the exception with the msg message.
void error(const std::string& msg);
}
//*****************************************************************************
namespace CAD_Calligraphy{
class Shp_istream; // Stream for SHP file reading.
class Shp_ostream; // Stream for SHP file writing.
class Token; // Token of the SHP file.
// TODO: The next both rows is not allowed (for nested types):
enum Token::Type; // Type of Token item.
class Token::Some_inner_class; // Class for internal use in the Token.
}
//*****************************************************************************
}
#endif
ネストされた型がなければ、型の階層は完全ではありません。どうすればこの問題を解決できますか?
PSコメントに、ネストされた型に関する情報を書き込むことができます。これが唯一の解決策だと思います。私は正しいですか?
ありがとうございました。