0026936: Drawbacks of inlining in new type system in OCCT 7.0 -- automatic
[occt.git] / src / CDM / CDM_COutMessageDriver.cxx
CommitLineData
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
92efcf78 21IMPLEMENT_STANDARD_RTTIEXT(CDM_COutMessageDriver,CDM_MessageDriver)
22
7fd59977 23//=======================================================================
24//function : Write
25//purpose :
26//=======================================================================
7fd59977 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;
08b86c1d 50 delete [] anAsciiString;
7fd59977 51}