0024023: Revamp the OCCT Handle -- ambiguity
[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
16#include <CDM_COutMessageDriver.ixx>
17#include <Standard_PCharacter.hxx>
18//=======================================================================
19//function : Write
20//purpose :
21//=======================================================================
22
23void CDM_COutMessageDriver::Write (const Standard_ExtString aString)
24{
25 // Find the length of the input string
26 Standard_ExtCharacter aChar = aString[0];
27 Standard_Integer aLength = 0;
28 while (aChar) {
29 if (IsAnAscii(aChar) == Standard_False)
30 return;
31 aChar = aString [++aLength];
32 }
33
34 // Copy the input string to ASCII buffer
35 Standard_PCharacter anAsciiString = new Standard_Character [aLength+2];
36 Standard_Integer anI = 0;
37 while (anI < aLength) {
38 anAsciiString[anI] = Standard_Character (aString[anI]);
39 ++ anI;
40 }
41 anAsciiString[anI+0] = '\n';
42 anAsciiString[anI+1] = '\0';
43
44 // Output
45 cout << anAsciiString << flush;
08b86c1d 46 delete [] anAsciiString;
7fd59977 47}