0026936: Drawbacks of inlining in new type system in OCCT 7.0 -- automatic
[occt.git] / src / CDM / CDM_COutMessageDriver.cxx
... / ...
CommitLineData
1// Created on: 2001-08-30
2// Created by: Alexander GRIGORIEV
3// Copyright (c) 2001-2014 OPEN CASCADE SAS
4//
5// This file is part of Open CASCADE Technology software library.
6//
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
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.
12//
13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
15
16
17#include <CDM_COutMessageDriver.hxx>
18#include <Standard_PCharacter.hxx>
19#include <Standard_Type.hxx>
20
21IMPLEMENT_STANDARD_RTTIEXT(CDM_COutMessageDriver,CDM_MessageDriver)
22
23//=======================================================================
24//function : Write
25//purpose :
26//=======================================================================
27void CDM_COutMessageDriver::Write (const Standard_ExtString aString)
28{
29 // Find the length of the input string
30 Standard_ExtCharacter aChar = aString[0];
31 Standard_Integer aLength = 0;
32 while (aChar) {
33 if (IsAnAscii(aChar) == Standard_False)
34 return;
35 aChar = aString [++aLength];
36 }
37
38 // Copy the input string to ASCII buffer
39 Standard_PCharacter anAsciiString = new Standard_Character [aLength+2];
40 Standard_Integer anI = 0;
41 while (anI < aLength) {
42 anAsciiString[anI] = Standard_Character (aString[anI]);
43 ++ anI;
44 }
45 anAsciiString[anI+0] = '\n';
46 anAsciiString[anI+1] = '\0';
47
48 // Output
49 cout << anAsciiString << flush;
50 delete [] anAsciiString;
51}