Currently there are several parts:

-nsAssistantEnhX::nsTypeIdReg::CTypeIdReg template:

It's used like a category-tuple but only one type is allowed to exist in one CTypeIdReg object declaration. If one type was used as more than one template-parameters, the compiling would fail. You may treat the CTypeIdReg class as a type-set (the 'set' in mathiematia).
There are up to 127 types could be as the template parameters at the same time during instance a CTypeIdReg class.

-nsAssistantEnhX::nsTypeIdReg::ExtractVal function:

Safe-cast to a sub-object from a CTypeIdReg object.
If an object 'o1' is defined like:
    CTypeIdReg<int, long, float, unsigned int> o1;
then:
    CTypeIdReg<long, float, unsigned int> & oq1 = ExtractVal(o1);
    CTypeIdReg<float, unsigned int> & oq1 = ExtractVal(o1);
    CTypeIdReg<unsigned int> & oq1 = ExtractVal(o1);
are the o1's sub-objects, but something like
CTypeIdReg<int, long, unsigned int>, CTypeIdReg<int, long, float> are not.

-STATIC_ASSERT() macro:

When it be used, the compiling will fail if the expression between two brackets is false result (like the 'static_assert' keyword does in C++0x).

-nsAssistantEnhX::nsAutoGdiProcessor

This namespace contains the GDI resource management classes, as the alternative to one of the directly GDI32 APIs' calls. Note that the usage of the classes/functions in this namespace is very simple.
This solution handles GetDC/ReleaseDC, BeginPaint/EndPaint, SelectObject, GDI resource creators/ DeleteObject. It has solved the management holes that the librarys like MFC unsolved yet(i hope one day this part of the library could become the part of MFC). Whatever you organize your code, the GDI-res management result is positive, no leaks, no exceptions, no wrong-placed resources(if incorrectly calls SelectObject, for example.). In worst case, your code will become uncompiledable until you fixed the problems left.

nsAutoGdiProcessor

-DIGIT_COUNT_OF() macro:

Output the count of decimial digitals of a constant integer.
A sample is here:
    UINT uTst;
    ...
    ...// uTst is be assigned.
    ...
    TCHAR szOut[DIGIT_COUNT_OF(UINT, -1) + 1];
    ...
    int iLen = _sntprintf_s(szOut, sizeof(szOut) / sizeof(szOut[0]) - 1U, _T("%u"), uTst);
    szOut[iLen] = _T('\0');

Last edited Mar 21, 2011 at 1:19 PM by UnitUniverse, version 19

Comments

No comments yet.