_First, _Last, _Mid, _Next, _Dest, _Before, _After, _Begin, _End, _Left, _Right, _Idx, _Temp, _Prev,
_Count, _Distance,_Old, _New, _Val, _Found,_Result
_InIt, _OutIt, _FwdIt, _BidIt, _Ty, _Fn, _Pr.
_First, _Last, _Mid, _Next, _Dest, _Before, _After, _Begin, _End, _Left, _Right, _Idx, _Temp, _Prev,
_Count, _Distance,_Old, _New, _Val, _Found,_Result
_InIt, _OutIt, _FwdIt, _BidIt, _Ty, _Fn, _Pr.
・ class _Tr = char_traits<_E>
template<class _E,
class _Tr = char_traits<_E>,
class _A = allocator<_E> >
class basic_string {}
・ Operator overload
_Myt& operator=(const _Myt& _X){}
_Myt& operator+=(const _Myt& _X){}
・ Typename
template<class _Iter>
struct iterator_traits
{ // get traits from iterator _Iter
typedef typename _Iter::iterator_category iterator_category;
typedef typename _Iter::value_type value_type;
typedef typename _Iter::difference_type difference_type;
typedef difference_type distance_type; // retained
typedef typename _Iter::pointer pointer;
typedef typename _Iter::reference reference;
};
・ Marco
_STD_BEGIN
…
_STD_END
・ Nested class.
class _CRTIMP ios_base {
class failure : public runtime_error { … };
… …
};
・ Explicit
explicit basic_ios(_Mysb *_S)
|
|
C++中有两种"用户定义的型别转换":型别转换操作符和单参数构造函数。
explicit就是用来禁止"单参数构造函数"的型别转换功能的。
・ inline
inline ios_base& __cdecl boolalpha(ios_base& _I)
{_I.setf(ios_base::boolalpha);
return (_I); }
・ exception, failure, allocator, scentry
・ Using
Class MyRegOpen{
using std::nothrow;
}
命名空间(Namespace)
与STL相关的概念是命名空间(namespace)。STL定义在std命名空间中。有3种方法声明使用的命名空间:
1.用using关键字使用这个命名空间,在文件的顶部,但在声明的头文件下面加入:
using namespace std;
这对单个工程来说是最简单也是最好的方法,这个方法可以把你的代码限定在std命名空间中。
2.使用每一个模板前对每一个要使用的对象进行声明(就像原形化):
using std::cout;
using std::endl;
using std::flush;
using std::set;
using std::inserter;
尽管这样写有些冗长,但可以对记忆使用的函数比较有利,并且你可以容易地声明并使用其他命名空间中的成员。
3.在每一次使用std命名空间中的模版时,使用std域标识符。比如:
typedef std::vector VEC_STR;
这种方法虽然写起来比较冗长,但是是在混合使用多个命名空间时的最好方法。一些STL的狂热者一直使用这种方法,并且把不使用这种方法的人视为异类。一些人会通过这种方法建立一些宏来简化问题。
除此之外,你可以把using namespace std加入到任何域中,比如可以加入到函数的头部或一个控制循环体中。
・ Typename
・ 在c++Template中很多地方都用到了typename与class这两个关键字,而且好像可以替换,是不是这两个关键字完全一样呢?
相信学习C++的人对class这个关键字都非常明白,class用于定义类,在模板引入c++后,最初定义模板的方法为: template<class T>......
在
这里class关键字表明T是一个类型,后来为了避免class在这两个地方的使用可能给人带来混淆,所以引入了typename这个关键字,它的作用同
class一样表明后面的符号为一个类型,这样在定义模板的时候就可以使用下面的方式了: template<typename
T>......
在模板定义语法中关键字class与typename的作用完全一样。
typename难道仅仅在模板定义中起作用吗?其实不是这样,typename另外一个作用为:使用嵌套依赖类型(nested depended name),如下所示:
・ class MyArray
{
public:
typedef int LengthType;
.....
}
template<class T>
void MyMethod( T myarr )
{
typedef typename T::LengthType LengthType;
LengthType length = myarr.GetLength;
}
・
这个时候typename的作用就是告诉c++编译器,typename后面的字符串为一个类型名称,而不是成员函数或者成员变量,这个时候如果前面没有
typename,编译器没有任何办法知道T::LengthType是一个类型还是一个成员名称(静态数据成员或者静态函数),所以编译不能够通过。
Question:
1. extern template class _CRTIMP basic_ios<char, char_traits<char> >; ??
2. why static?
Struct char_traits{
static void __cdecl assign(_E& _X, const _E& _Y);
}
3. s
From Dmwiki
Jump to: navigation, search
There is a requirement that wrapped CHtmlView into a COM for previewing all kinds of office document. It must hide all menu and toolbars for increase the viewing area and should support office XP\2003\2007.
For Office 2003 it is easy to do that. But for Word 2007, It doesn’t work! It stumppe us for several weeks. I googled and also posted this question in msdn newsgroup, nobody gives the correct solution.
Some MVP of Office said the new Office interface was consciously designed to NOT allow the developer as much freedom with which tools are provided to the user. You won't be able to recover this realestate completely.
Solution for Office 2003:
Dim iCounter As Integer
For iCounter = 1 To CommandBars.Count
Application.CommandBars(iCounter).Enabled = False
Next
Possible solution for Word 2007 we have tried:
One possibility would be to define and include an XML part for the Ribbon in the document's file structure. The Ribbon XML can set the ribbon to start from scratch( startFromScratch=TRUE) in CustomUI.xml. which would make it "empty". But you can't get rid of the big, round "Office" button that will contain a limited number of basic commands. But this could not hide all the ribbon area completely.The big round button and quick access area and some other command,such as "help",will remain.
Beyond that, the object model provides ToggleRibbon method, which will cycle between "collapsing" the ribbon to look like an old-style MenuBar and expanding it again.
The third possible solution is trying the Windows API to find the windows handle of the ribbon, and then use API to hide the windows. This solution did could hide the ribbon but another problem is we could not minimize it.
Correct Solution for Word 2007:
When an Office app is OLE hosted, you can toggle on and off the UI using an OLE command. Like this:
#include "exdispid.h"
OLECMDF cmd = QueryStatusWB( OLECMDID_HIDETOOLBARS);
if( !(cmd & OLECMDF_LATCHED))
ExecWB(OLECMDID_HIDETOOLBARS, OLECMDEXECOPT_PROMPTUSER, NULL, NULL);
现在的软件产品都强调"整合",像微软的各种产品都尽量整合在一起,其开发类产品比如Visual studio,Sql server management studio,还有新开发的 Express studio等等通过visual studio来整合,Office 系列更是整合的经典。 Autodesk现在也提了个Autodesk 3.0的概念,其中重要的一点是2D CAD, 3D CAD, PDM\PLM产品全部整合在一起,再结合ERP系统提供给用户的就是一整套Solution。 Dassault在这方面已经走在前面了。Google的g各种产品基本都通过其核心的搜索技术整合起来的。