﻿/*
	© 2010-2014 FrankHB.

	This file is part of the YSLib project, and may only be used,
	modified, and distributed under the terms of the YSLib project
	license, LICENSE.TXT.  By continuing to use, modify, or distribute
	this file you indicate that you have read the license and
	understand and accept it fully.
*/

/*!	\file Definitions.txt
\ingroup Documentation
\brief 方法和公共域定义与说明。
\version r12319
\author FrankHB <frankhb1989@gmail.com>
\since 早于 build 132
\par 创建时间:
	2010-01-26 19:34:51 +0800
\par 修改时间:
	2014-05-24 17:02 +0800
\par 文本编码:
	UTF-8
\par 模块名称:
	Documentation::Definitions
*/


/*

体例说明：
引用标记参见 [Documentation::CommonRules @@0.1] 。

基本内容参考 [Documentation::CommonRules @@1.3.1] 。

以下为附加语法和语义说明。

$ //作用于受限制的字符序列（语言规范中定义的标识符或关键字）前，表示此字符序列不由编译程序提供语义实现。

$region $name_expr //表示字符序列 $name_expr 标记的位置，可用于标记段落。供文档规格化工具使用。

$import //导入实体。
$export //导出实体，显式使用表示强调无论实现如何，应向外部提供形式上和之后说明一致的接口。

$code {} //表示（源）代码片段。
$unit $unit_n //单元：指称一个编译单元（一般应为语言规范中定义的翻译单元）。单元名称 $unit_n 为可变部分，是语言规范中定义的标识符或关键字。
$header $header_n //头文件：指称一个头文件。头文件名标识字符序列 $header_n 是可变部分，同语言标准中 #include $header_n 的用法，或为通配符。
$dir //表示目录。

*/

$region $synopsis $begin

// ! 默认由外部（如编译器命令行）提供。

// YBase 既定宏污染列表。
// YB_* 保留给 YBase 使用。（除了 ydef.h 中定义的宏和包含守护宏外，可能使用后被 #undef 取消定义。）
// YPP_* 是通用于预处理阶段的辅助宏。
$dir YBase
{
$header *
{
YB_INC_*
}
$header YDefinition
{
YB_IMPL_CPP
YB_IMPL_MSCPP
YB_IMPL_GNUCPP
YPP_Empty
YPP_Comma
YPP_Join
YPP_Concat
yimpl
YB_HAS_ALIGNAS
YB_HAS_ALIGNOF
YB_HAS_BUILTIN_NULLPTR
YB_HAS_CONSTEXPR
YB_HAS_NOEXCEPT
YB_ATTR(...)
YB_ALLOCATOR
YB_EXPECT(expr, constant)
YB_LIKELY(expr)
YB_UNLIKELY(expr)
YB_PURE
YB_STATELESS
!YB_DLL
!YB_BUILD_DLL
YB_API
YB_Use_YAssert @ !defined(NDEBUG) && !defined(YB_Use_YAssert)
YB_Use_YTrace
YB_USE_EXCEPTION_SPECIFICATION
yalignof(_type)
yconstexpr
yconstfn
ythrow(*)?
ynothrow
ynoexcept(*)?
yconstraint
yassume
yoffsetof(_type, _member)
yforward(_expr)
yunseq
}
$dir ystdex
{
$header TypeOperation
{
YB_TYPE_OP_TEST_2(_n, _expr)
}
$header CAssert
{
YAssert(*)
YTrace(*)
}
} //$dir ystdex;
} //$dir YBase;

// YFramework 既定宏污染列表。
//以下保留宏名可能被 #undef 取消定义。
// YF_* 保留给 YFramework 使用。
// YFM_* 保留给 YFramework 使用作为模块包含文件宏。
// YCL_* 保留给 YFramework/YCLib 使用。
// YSL_* 保留给 YFramework/YSLib 使用。
// NPL_* 保留给 YFramework/NPL 使用。
// INC_* 和 Inc_* 保留给 YFramework 的其它部分和客户程序使用。
// 约定 INC 和 Inc 分别用于表示头文件公开/非公开头文件的包含守护宏。
$herder *
{
YCL_INC_* // YCLib 公开头文件包含守护宏。
YCL_Inc_* // YCLib 非公开头文件包含守护宏。
YSL_INC_* // YSLib 公开头文件包含守护宏。
YSL_Inc_* // YSLib 非公开头文件包含守护宏。
YCL_DEBUG_*
YSL_DEBUG_*
}

$dir YCLib
{
$header Platform
{
YF_API
YF_DLL
YF_Platform_*
YF_Platform
YF_Multithread
YF_Hosted
YCL_API_*
YCL_DS
YCL_MinGW32
}
$header Debug
{
YCL_Log
YCL_Trace
YTraceDe
}
$header NativeAPI
{
YCL_YCOMMON_H
YSL_YSBUILD_H
#if YCL_Win32
mkdir
#endif
}
$header FileSystem
{
YCL_PATH_DELIMITER
YCL_PATH_SEPARATOR
YCL_PATH_ROOT
}
$header Video
{
YCL_PIXEL_FORMAT_XYZ555
} //$dir YCLib;
$header Input
{
YCL_KEY*
}
} //$dir YCLib;

$dir CHRLib
{
$header CHRLib
{
}
} //$dir CHRLib;

$dir YSLib
{
$dir Adaptor
{
$header Config
{
YSL_USE_MEMORY_DEBUG
YSL_MULTITHREAD
YSL_USE_COPY_ON_WRITE
YSL_USE_YASLI_VECTOR
YSL_USE_FLEX_STRING
YSL_OPT_SMALL_STRING_LENGTH
YSL_DEBUG_MSG
}
} //$dir Adaptor;

$dir Core
{
$header YBaseMacro
{
YSL_BEGIN
YSL_END
YSL_BEGIN_NAMESPACE(s)
YSL_END_NAMESPACE(s)
_yInterface
_yInterfaceHead(_n)
PDeclI(_n)
DeclI(_attr, _n)
DeclDerivedI(_attr, _n, ...)
ImplI(...)
ImplA(...)
DeclIEntry(_signature)
EndDecl
DeclSEntry(...)
ImplS(...)
DefExtendClass1(_n, _b, _a)
PDefH(_t, _n, ...)
PDefHOp(_t, _op, ...)
PDefCvt(_t)
ImplExpr(...)
ImplRet(...)
ImplThrow(...)
ImplUnseq(...)
ImplBodyBase(_b, _n, ...)
ImplBodyMem(_m, _n, ...)
DefEmptyDtor(_t)
ImplEmptyDtor(_t)
DefDeCtor(_t)
DefDelCtor(_t)
DefDeCopyCtor(_t)
DefDelCopyCtor(_t)
DefDeMoveCtor(_t)
DefDelMoveCtor(_t)
DefDeDtor(_t)
DefDelDtor(_t)
DefDeCopyAssignment(_t),
DefDelCopyAssignment(_t),
DefDeMoveAssignment(_t),
DefDelMoveAssignment(_t)
DefCvt(_q, _t, ...)
DefCvtBase(_q, _t, _b)
DefCvtMem(_q, _t, _m)
DefPred(_q, _n, ...)
DefPredBase(_q, _n, _b)
DefPredMem(_q, _n, _m)
DefGetter(_q, _t, _n, ...)
DefGetterBase(_q, _t, _n, _b)
DefGetterMem(_q, _t, _n, _m)
DefSetter(_t, _n, _m)
DefSetterDe(_t, _n, _m, _defv)
DefSetterBase(_t, _n, _b)
DefSetterBaseDe(_t, _n, _b, _defv)
DefSetterMem(_t, _n, _m)
DefSetterMemDe(_t, _n, _m, _defv)
DefSetterEx(_t, _n, _m, _e)
DefSetterDeEx(_t, _n, _m, _defv, _e)
DefClone(_q, _t)
DefSwap(_q, _t)
DefSubscriptor(_q, _type, ...)
DefSubscriptorBase(_q, _type, _tBase, _vBaseN, ...)
DefFwdFn(_q _type, _name, ...)
DefFwdTmpl(_q, _type, _name, ...)
DefBitmaskAnd(_tBitmask, _tInt)
DefBitmaskOr(_tBitmask, _tInt)
DefBitmaskXor(_tBitmask, _tInt)
DefBitmaskNot(_tBitmask, _tInt)
DefBitmaskAndAssignment(_tBitmask, _tInt)
DefBitmaskOrAssignment(_tBitmask, _tInt)
DefBitmaskXorAssignment(_tBitmask, _tInt)
DefBitmaskOperations(_tBitmask, _tInt)
DefBitmaskEnum(_tEnum)
}
$header YEvent
{
DefDelegate(_n, _tSender, _tEventArgs)
EventT(_tEventHandler)
DepEventT(_tEventHandler)
DeclEvent(_tEventHandler, _n)
DeclDepEvent(_tEventHandler, _n)
DeclEventRef(_tEventHandler, _n)
DeclDepEventRef(_tEventHandler, _n)
DeclIEventEntry(_tEventHandler, _n)
DeclIDepEventEntry(_tEventHandler, _n)
DefEventGetter(_q, _tEventHandler, _n, _m)
DefEventGetterBase(_q, _tEventHandler, _n, _b)
DefEventGetterMem(_q, _tEventHandler, _n, _m)
DefDepEventGetter(_q, _tEventHandler, _n, _m)
DefDepEventGetterBase(_q, _tEventHandler, _n, _b)
DefDepEventGetterMem(_q, _tEventHandler, _n, _m)
DefExtendEventMap(_n, _b)
}
$header YMessageDefinition
{
SM_Null
SM_Set
SM_Quit
SM_Bound
SM_Task
SM_Paint
SM_Input
DefMessageTarget
}
} //$dir Core;
$dir UI
{
$header YControl
{
DefEventTypeMapping(_n, _tEventHandler)
}
$header WidgetIteration
{
DefWidgetSubscriptor(...)
DefWidgetSubscriptorBase(_tBase, ...)
DefWidgetBegin(_tIter)
DefWidgetEnd(_tIter)
DefWidgetChildrenGetter
DefWidgetMemberIterationOperations(_tIter)
DefWidgetMemberIteration(...)
DefWidgetMemberIterationBase(_tBase, ...)
}
$unit Loader
{
DeclDynWidget(_t, _n, ...)
DeclDynWidgetN(_t, _n, ...)
DeclDynWidgetNode(_t, _n)
}
$unit Scroll
{
YSL_UI_ATRACK_PARTIAL_INVALIDATION
}
} //$dir UI;
$dir Service
{
$unit YGDI
{
YSL_FAST_BLIT
}
} //$dir Service;
} //$dir YSLib;

$dir Helper
{
$header YShellHelper
{
DefDynInitRef(_t, _n, _e)
}
$header GUIApplication
{
#if YCL_MINGW32
YF_Raise_Win32Exception(...)
#endif
}
} //$dir Helper;


// YFramework 中非 YSLib 本体或 YGlobal 定义列表。

//非本体类列表。
$header Core::YShellDefinition
{
	namespace Shells
	{}
} //$header Core::YShellDefinition;

//非 YSLib 本体函数列表。
$header Core::YApplication
{
	extern Application&
	FetchAppInstance() ynothrow;
} //$header Core::YApplication;

$unit Helper::YGlobal
{
#if YCL_Android
	extern void
	::y_android_main();
#endif
} //$unit Helper::YGlobal;


//非 YGlobal 非 constexpr 的命名空间作用域对象和类静态对象列表。

$dir YCLib
{

$unit YDebug
{
	namespace platform
	{
$unit.impl:
		static bool bDebugStatus;
		static bool bUninitializedTimers;
	}
}

$dir CHRLib
{

$unit CharacterMapping
{
namespace CHRLib
{

//默认字符集。
const Encoding CP_Default = CharSet::UTF_8;
const Encoding CP_Local = CharSet::GBK;

//编码转换表。
const byte cp17[] = {0};
extern "C"
{
	extern const byte cp113[];
	//extern const byte cp2026[13658];
}
const byte cp2026[] = {0};
} // namespace CHRLib;
}

} //$dir CHRLib;

} //$dir YCLib;

$dir Adaptor
{

$namespace.using YSLib:

} //$dir Adaptor;

$dir Core
{

$header YCounter
{
	class template GMCounter
	{
		static count_t nCount, nTotal; //!< 实例生成计数和实例计数。
	};
}

$unit YGDIBase
{
	namespace Drawing
	{
		class template GBinaryGroup
		{
			static const GBinaryGroup Zero; //!< 无参数构造的原点对象。
			static const GBinaryGroup Invalid; //!< 无效（不在屏幕坐标系中）对象。
		};

		class Size
		{
			static const Size Zero; //!< 无参数构造的零元素对象。
			static const Size Invalid; //!< 无效对象。
		};

		class Rect
		{
			static const Rect Empty; //!< 无参数构造的空矩形对象。
			static const Rect Invalid; //!< 无效对象。
		};
	}
}

$unit YString
{
	class String
	{
		static ucs2_t* s_str; //!< 内码转换生成字符串临时指针。
	};
}

$header YStorage
{
	class template GStaticCache
	{
		static PointerType _ptr;
	};
	class template GLocalStaticCache
	{
		static PointerType _ptr;
	};
}

$unit YFileSystem
{
	namespace IO
	{
		class Path
		{
			static const ValueType Slash;
			static const Path Now;
			static const Path Parent;
		};
	}
}

$header YStorage
{
	//略。
}

} //$dir Core;

$dir Service
{

$unit YTimer
{
	namespace Timers
	{
		namespace
		{
			bool NotInitialized;
		}
	}
}

} //$dir Service;


// std 命名空间扩展。
namespace std
{
} // namespace std;

// YCLib 全局命名空间污染列表。

$header "ydef.h"
{
#ifndef YCL_HAS_BUILTIN_NULLPTR
using ystdex::nullptr;
#endif
} //$header "ydef.h";

// std 命名空间兼容性污染列表。

$header <Platform.h>
{
} //$header <Platfrom.h>

$header <ystdex/rational.hpp>
{

template<typename _tBase, ystdex::size_t _vInt, ystdex::size_t _vFrac>
std::numeric_limits<ystdex::fixed_point>;

} //$header <rational.hpp>

//既定 ystdex 命名空间污染列表。
$header YDefinition
{

using std::ptrdiff_t;
using std::size_t;
using std::wint_t;

} //$header YDefinition;

$header YStandardExtend
{
	//
} //$header YStandardExtend;

$header YStandardExtend::TypeOperation : header YStandardExtend
{

using std::integral_constant;
using std::true_t;
using std::false_t;

using std::is_void;
using std::is_integral;
using std::is_floating_point;
using std::is_array;
using std::is_pointer;
using std::is_lvalue_reference;
using std::is_rvalue_reference;
using std::is_m_object_pointer;
using std::is_m_function_pointer;
using std::is_enum;
using std::is_class;
using std::is_union;
using std::is_function;

using std::is_reference;
using std::is_arithmetic;
using std::is_fundamental;
using std::is_object;
using std::is_scalar;
using std::is_compound;
using std::is_m_pointer;

using std::is_const;
using std::is_volatile;
using std::is_trivial;
//	using std::is_trivially_copyable;
using std::is_standard_layout;
using std::is_pod;
using std::is_literal_type;
using std::is_empty;
using std::is_polymorphic;
using std::is_abstract;

using std::is_signed;
using std::is_unsigned;

using std::is_constructible;
#if 0
using std::is_default_constructible;
using std::is_copy_constructible;
using std::is_move_constructible;

using std::is_assignable;
using std::is_copy_assignable;
using std::is_move_assignable;

using std::is_destructible;

using std::is_trivially_constructible;
using std::is_trivially_default_constructible;
using std::is_trivially_copy_constructible;
using std::is_trivially_move_constructible;

using std::is_trivially_assignable;
using std::is_trivially_copy_assignable;
using std::is_trivially_move_assignable;
using std::is_trivially_destructible;

using std::is_nothrow_constructible;
using std::is_nothrow_default_constructible;
using std::is_nothrow_copy_constructible;
using std::is_nothrow_move_constructible;

using std::is_nothrow_assignable;
using std::is_nothrow_copy_assignable;
using std::is_nothrow_move_assignable;

using std::is_nothrow_destructible;
#endif
using std::has_virtual_destructor;

using std::alignment_of;
using std::rank;
using std::extent;

using std::is_same;
using std::is_b_of;
using std::is_convertible;

using std::remove_const;
using std::remove_volatile;
using std::remove_cv;
using std::add_const;
using std::add_volatile;
using std::add_cv;

using std::remove_reference;
using std::add_lvalue_reference;
using std::add_rvalue_reference;

using std::make_signed;
using std::make_unsigned;

using std::remove_extent;
using std::remove_all_extents;

using std::remove_pointer;
using std::add_pointer;

using std::aligned_storage;
using std::decay;
using std::enable_if;
using std::conditional;
using std::common_t;
//	using std::underlying_t;
using std::result_of;

} //$header YStandardExtend::TypeOperation;

//既定 platform 命名空间污染列表。
$header "ycommon.h"
{
	// using ystdex;
} //$header "ycommon.h";


//既定 YSLib 命名空间污染列表。
$header Adaptor::YAdaptor
{
//目标平台中立接口。

//通用数据类型。
using u8 = std::uint8_t;
using u16 = std::uint16_t;
using u32 = std::uint32_t;
using u64 = std::uint64_t;
using s8 = std::int8_t;
using s16 = std::int16_t;
using s32 = std::int32_t;
using s64 = std::int64_t;
using vu8 = volatile u8;
using vu16 = volatile u16;
using vu32 = volatile u32;
using vu64 = volatile u64;
using vs8 = volatile s8;
using vs16 = volatile s16;
using vs32 = volatile s32;
using vs64 = volatile s64;

//调用分派。
using ystdex::seq_apply;
using ystdex::unseq_apply;

//实用类型。
using ystdex::noncopyable;
using ystdex::nonmovable;
using ystdex::nullptr_t;

//数学库函数。
// TODO: Use std::round for libstd++ @ devkitPro.
//	@ !defined _GLIBCXX_USE_C99_MATH_TR1;
using ::round;

//算法。
using std::min;
using std::max;

//助手功能。
using ystdex::arrlen;
using std::to_string;
using ystdex::to_string;


//非目标平台中立接口。

//平台通用数据类型。
using ystdex::byte;
using ystdex::octet;
using ystdex::errno_t;
using ystdex::ptrdiff_t;
using ystdex::size_t;
using ystdex::wint_t;

using namespace platform::Descriptions;

//基本实用例程。

//文件系统例程。
using platform::ufopen;
using platform::ufexists;
using platform::u16getcwd_n;
using platform::uchdir;
using platform::umkdir;
using platform::urmdir;
using platform::uunlink;
using platform::uremove;
using platform::truncate;

//系统处理函数。
using platform::terminate;

//基本图形定义。
using platform::SPos;
using platform::SDst;

//基本输出接口。
using platform::InitVideo;

//计时器和时钟。
using platform::GetTicks;
using platform::GetHighResolutionTicks;
using platform::StartTicks;

//输入类型。
using platform::KeyIndex;
using platform::KeyBitsetWidth;
using platform::KeyInput;
namespace KeyCategory = platform::KeyCategory;
namespace KeyCodes = platform::KeyCodes;

using platform::FindFirstKey;
using platform::FindNextKey;
using platform::MapKeyChar;

namespace Drawing
{

using platform::(BGRA, RGBA);
using platform::(BitmapPtr, ConstBitmapPtr);
using platform::(MonoType, AlphaType)
using platform::Color;
namespace ColorSpace = platform::ColorSpace;

} // namespace Drawing;

namespace IO
{
//文件系统抽象。
using platform::NativePathCharType;
using platform::CS_Path;

//! \since build 474
//@{
using platform::PathCategory;
using platform::NodeCategory;
//@}

//! \since build 411
//@{
using platform::FileOperationFailure;
using platform::DirectorySession;
using platform::HDirectory;
using platform::FileIterator;
//@}
using platform::IsAbsolute;
using platform::GetRootNameLength;

} // namespace IO;

//库适配器。

} //$header Adaptor::YAdaptor;

$Adaptor::Container : Adaptor::YAdaptor
{
#ifdef YSL_USE_YASLI_VECTOR
	using yasli::vector;
#else
	using std::vector
#endif
	using std::forward_as_tuple, std::get, std::ignore, std::make_pair, std::make_tuple, std::pair, std::tie, std::tuple, std::tuple_cat;
	using std::list, std::map, std::set, std::stack, std::queue, std::priority_queue, std::unordered_map, std::unordered_set;
} //$header Adaptor::Container;

$header Adaptor::YReference
{
	using std::bad_weak_ptr;
	using std::const_pointer_cast;
	using std::dynamic_pointer_cast;
	using std::enable_shared_from_this;
	using std::get_deleter;
	using ystdex::make_shared;
	using ystdex::make_unique;
	using ystdex::get_raw;
	using ystdex::reset;
	using ystdex::share_raw;
	using std::shared_ptr;
	using std::static_pointer_cast;
	using std::unique_ptr;
	using ystdex::unique_raw;
	using std::weak_ptr;
} //$header Adaptor::YReference;

$header Adaptor::YTextBase
{

namespace Text
{
	using namespace CHRLib;
} // namespace Text;
using Text::ucs4_t, Text::ucs2_t, Text::ucsint_t;

} //$header YAdaptor::YTextBase;

$header Core::YShellDefinition : Adaptor::YAdaptor
{
	using Shells::Shell;

	using Text::String;
} //$header Core::YShellDefinition;

$header Core::YMessage : Core::YShellDefinition
{
	using Messaging::Message;
} //$header Core::YCoreUtilities;

$header Core::YShell : Core::YMessage
{
	using Shells::Activate;
	using Shells::FetchShellHandle;
} //$header Core::YShell;

$header Core::YApplication : Core::YMessage
{
	using Messaging::MessageQueue;
} //$header Core::YApplication;

$header Core::YGDIBase
{
} //$header Core::YGDIBase;
$header Core::YGDI : Core::YGDIBase
{
} //$header Core::YGDI;

//$header Core::YResource : Core::YGDI;

$header UI::YComponent : YMessage
{
	namespace UI
	{
		using HBrush;

		using Drawing::PixelType, Drawing::BitmapPtr, Drawing::ConstBitmapPtr, Drawing::Color;

		using Drawing::Point, Drawing::Vec, Drawing::Size, Drawing::Rect;
		using Drawing::Graphics, Drawing::PaintContext;
	} // namespace UI;
} //$header UI::YComponent;

$header UI::YWidget : UI::YComponent, UI::YRenderer, UI::YFocus, Core::YResource, UI::YWidgetEvent
{
} //$header UI::YWidget;

$header UI::YControl : UI::YWidgetEvent
{
	namespace UI
	{
		using namespace Drawing;
	} // namespace UI;
} //$header UI::YControl;

$header Helper::Shell_DS : Core::YShell
{
	namespace DS
	{
		using YSLib::UI::Desktop;
	} // namespace DS;
} //$header Helper::Shell_DS;

$header Helper::DSMain : Core::YGDIBase
{
	//! \brief 运行时平台。
	namespace DS
	{
		using namespace platform_ex;
	} // namespace DS;
} //$header Helper::DSMain;

} //$code YSLib;

///

$region $synopsis $end;

