merge the formfield patch from ooo-build
[ooovba.git] / testshl2 / workben / test_ostringstream.cxx
blob5b287e41e6dd05ffcb805ec72d352fa194973671
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: test_ostringstream.cxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_testshl2.hxx"
34 #include <stdlib.h>
35 #include <memory>
36 #include <sstream>
37 #include <iostream>
38 #include <bitset>
40 #include <sal/types.h>
43 class TestFactoryRegistry
45 public:
46 void checkFunc(char* foo);
47 void checkFunc2(char* foo);
48 void checkFunc3(char* foo);
52 void TestFactoryRegistry::checkFunc(char* /* foo */ )
54 static int serialNumber = 1;
56 std::ostringstream ost;
57 //! could this be the problem?
58 ost << "@Dummy@" << serialNumber++;
59 std::cout << ost.str() << std::endl;
62 void TestFactoryRegistry::checkFunc2(char* /* foo */)
64 static int serialNumber = 1;
66 std::ostringstream ost;
67 //! could this be the problem?
68 ost << "@Dummy@" << serialNumber;
69 serialNumber++;
70 std::cout << ost.str() << std::endl;
73 void TestFactoryRegistry::checkFunc3(char* /* foo */)
75 static int serialNumber = 1;
77 int nValue = serialNumber;
78 std::ostringstream ost;
79 //! could this be the problem?
80 ost << "@Dummy@" << nValue;
81 serialNumber++;
82 std::cout << ost.str() << std::endl;
85 static TestFactoryRegistry a;
86 static TestFactoryRegistry b;
87 static TestFactoryRegistry c;
89 // ----------------------------------- Main -----------------------------------
90 #if (defined UNX) || (defined OS2)
91 int main( int /* argc */ , char* /* argv */ [] )
92 #else
93 int _cdecl main( int /* argc */, char* /* argv */ [] )
94 #endif
96 std::ostringstream ost;
97 // sal_Int32 nValue = 1;
99 // ost << "@Dummy@" << nValue;
100 // ost << "dec: " << 15 << std::hex << " hex: " << 15 << std::endl;
102 // std::cout << ost.str() << std::endl;
104 char* cFoo = NULL;
106 a.checkFunc(cFoo);
107 a.checkFunc2(cFoo);
108 a.checkFunc3(cFoo);
110 b.checkFunc(cFoo);
111 b.checkFunc2(cFoo);
112 b.checkFunc3(cFoo);
114 c.checkFunc(cFoo);
115 c.checkFunc2(cFoo);
116 c.checkFunc3(cFoo);
118 return 0;