b311480e |
1 | // Created on: 2001-08-30 |
2 | // Created by: Alexander GRIGORIEV |
973c2be1 |
3 | // Copyright (c) 2001-2014 OPEN CASCADE SAS |
b311480e |
4 | // |
973c2be1 |
5 | // This file is part of Open CASCADE Technology software library. |
b311480e |
6 | // |
d5f74e42 |
7 | // This library is free software; you can redistribute it and/or modify it under |
8 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
9 | // by the Free Software Foundation, with special exception defined in the file |
10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
11 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
12 | // |
973c2be1 |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
7fd59977 |
15 | |
42cf5bc1 |
16 | |
17 | #include <CDM_COutMessageDriver.hxx> |
7fd59977 |
18 | #include <Standard_PCharacter.hxx> |
42cf5bc1 |
19 | #include <Standard_Type.hxx> |
20 | |
7fd59977 |
21 | //======================================================================= |
22 | //function : Write |
23 | //purpose : |
24 | //======================================================================= |
7fd59977 |
25 | void CDM_COutMessageDriver::Write (const Standard_ExtString aString) |
26 | { |
27 | // Find the length of the input string |
28 | Standard_ExtCharacter aChar = aString[0]; |
29 | Standard_Integer aLength = 0; |
30 | while (aChar) { |
31 | if (IsAnAscii(aChar) == Standard_False) |
32 | return; |
33 | aChar = aString [++aLength]; |
34 | } |
35 | |
36 | // Copy the input string to ASCII buffer |
37 | Standard_PCharacter anAsciiString = new Standard_Character [aLength+2]; |
38 | Standard_Integer anI = 0; |
39 | while (anI < aLength) { |
40 | anAsciiString[anI] = Standard_Character (aString[anI]); |
41 | ++ anI; |
42 | } |
43 | anAsciiString[anI+0] = '\n'; |
44 | anAsciiString[anI+1] = '\0'; |
45 | |
46 | // Output |
47 | cout << anAsciiString << flush; |
08b86c1d |
48 | delete [] anAsciiString; |
7fd59977 |
49 | } |