mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0029220: Application Framework - replace CDM_MessageDriver interface by Message_Messenger.
This commit is contained in:
@@ -17,13 +17,13 @@
|
||||
|
||||
#include <CDM_Application.hxx>
|
||||
#include <CDM_Document.hxx>
|
||||
#include <CDM_MessageDriver.hxx>
|
||||
#include <CDM_MetaData.hxx>
|
||||
#include <CDM_NullMessageDriver.hxx>
|
||||
#include <CDM_Reference.hxx>
|
||||
#include <Resource_Manager.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
#include <Message.hxx>
|
||||
#include <Message_Messenger.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(CDM_Application,Standard_Transient)
|
||||
|
||||
@@ -55,11 +55,12 @@ void CDM_Application::SetReferenceCounter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(CDM_MessageDriver) CDM_Application::MessageDriver()
|
||||
Handle(Message_Messenger) CDM_Application::MessageDriver()
|
||||
{
|
||||
static Handle(CDM_NullMessageDriver) theMessageDriver
|
||||
=new CDM_NullMessageDriver;
|
||||
return theMessageDriver;
|
||||
static Handle(Message_Messenger) theMessenger;
|
||||
if(theMessenger.IsNull())
|
||||
theMessenger = Message::DefaultMessenger();
|
||||
return theMessenger;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -69,7 +70,7 @@ Handle(CDM_MessageDriver) CDM_Application::MessageDriver()
|
||||
|
||||
void CDM_Application::Write(const Standard_ExtString aString)
|
||||
{
|
||||
MessageDriver()->Write(aString);
|
||||
MessageDriver()->Send(aString);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -31,8 +31,7 @@ class CDM_Reference;
|
||||
class CDM_MetaData;
|
||||
class CDM_Document;
|
||||
class Resource_Manager;
|
||||
class CDM_MessageDriver;
|
||||
|
||||
class Message_Messenger;
|
||||
|
||||
class CDM_Application;
|
||||
DEFINE_STANDARD_HANDLE(CDM_Application, Standard_Transient)
|
||||
@@ -48,8 +47,8 @@ public:
|
||||
//! used to search for Format.Retrieval resource items.
|
||||
Standard_EXPORT virtual Handle(Resource_Manager) Resources() = 0;
|
||||
|
||||
//! By default returns a NullMessageDriver;
|
||||
Standard_EXPORT virtual Handle(CDM_MessageDriver) MessageDriver();
|
||||
//! Returns default messenger;
|
||||
Standard_EXPORT virtual Handle(Message_Messenger) MessageDriver();
|
||||
|
||||
//! this method is called before the update of a document.
|
||||
//! By default, writes in MessageDriver().
|
||||
|
@@ -1,51 +0,0 @@
|
||||
// Created on: 2001-08-30
|
||||
// Created by: Alexander GRIGORIEV
|
||||
// Copyright (c) 2001-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <CDM_COutMessageDriver.hxx>
|
||||
#include <Standard_PCharacter.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(CDM_COutMessageDriver,CDM_MessageDriver)
|
||||
|
||||
//=======================================================================
|
||||
//function : Write
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void CDM_COutMessageDriver::Write (const Standard_ExtString aString)
|
||||
{
|
||||
// Find the length of the input string
|
||||
Standard_ExtCharacter aChar = aString[0];
|
||||
Standard_Integer aLength = 0;
|
||||
while (aChar) {
|
||||
if (IsAnAscii(aChar) == Standard_False)
|
||||
return;
|
||||
aChar = aString [++aLength];
|
||||
}
|
||||
|
||||
// Copy the input string to ASCII buffer
|
||||
Standard_PCharacter anAsciiString = new Standard_Character [aLength+2];
|
||||
Standard_Integer anI = 0;
|
||||
while (anI < aLength) {
|
||||
anAsciiString[anI] = Standard_Character (aString[anI]);
|
||||
++ anI;
|
||||
}
|
||||
anAsciiString[anI+0] = '\n';
|
||||
anAsciiString[anI+1] = '\0';
|
||||
|
||||
// Output
|
||||
cout << anAsciiString << flush;
|
||||
delete [] anAsciiString;
|
||||
}
|
@@ -1,61 +0,0 @@
|
||||
// Created on: 2001-08-30
|
||||
// Created by: Alexander GRIGORIEV
|
||||
// Copyright (c) 2001-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _CDM_COutMessageDriver_HeaderFile
|
||||
#define _CDM_COutMessageDriver_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <CDM_MessageDriver.hxx>
|
||||
#include <Standard_ExtString.hxx>
|
||||
|
||||
|
||||
class CDM_COutMessageDriver;
|
||||
DEFINE_STANDARD_HANDLE(CDM_COutMessageDriver, CDM_MessageDriver)
|
||||
|
||||
//! aMessageDriver for output to COUT (only ASCII strings)
|
||||
class CDM_COutMessageDriver : public CDM_MessageDriver
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Standard_EXPORT void Write (const Standard_ExtString aString) Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(CDM_COutMessageDriver,CDM_MessageDriver)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _CDM_COutMessageDriver_HeaderFile
|
@@ -1,21 +0,0 @@
|
||||
// Created on: 1998-10-29
|
||||
// Created by: Mister rmi
|
||||
// Copyright (c) 1998-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <CDM_MessageDriver.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(CDM_MessageDriver,Standard_Transient)
|
@@ -1,62 +0,0 @@
|
||||
// Created on: 1998-10-29
|
||||
// Created by: Jean-Louis Frenkel
|
||||
// Copyright (c) 1998-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _CDM_MessageDriver_HeaderFile
|
||||
#define _CDM_MessageDriver_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <Standard_ExtString.hxx>
|
||||
|
||||
|
||||
class CDM_MessageDriver;
|
||||
DEFINE_STANDARD_HANDLE(CDM_MessageDriver, Standard_Transient)
|
||||
|
||||
|
||||
class CDM_MessageDriver : public Standard_Transient
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Standard_EXPORT virtual void Write (const Standard_ExtString aString) = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(CDM_MessageDriver,Standard_Transient)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _CDM_MessageDriver_HeaderFile
|
@@ -1,27 +0,0 @@
|
||||
// Created on: 1998-10-29
|
||||
// Created by: Mister rmi
|
||||
// Copyright (c) 1998-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <CDM_NullMessageDriver.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(CDM_NullMessageDriver,CDM_MessageDriver)
|
||||
|
||||
CDM_NullMessageDriver::CDM_NullMessageDriver() {}
|
||||
|
||||
void CDM_NullMessageDriver::Write(const Standard_ExtString /*aString*/) {
|
||||
}
|
@@ -1,64 +0,0 @@
|
||||
// Created on: 1998-10-29
|
||||
// Created by: Jean-Louis Frenkel
|
||||
// Copyright (c) 1998-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _CDM_NullMessageDriver_HeaderFile
|
||||
#define _CDM_NullMessageDriver_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <CDM_MessageDriver.hxx>
|
||||
#include <Standard_ExtString.hxx>
|
||||
|
||||
|
||||
class CDM_NullMessageDriver;
|
||||
DEFINE_STANDARD_HANDLE(CDM_NullMessageDriver, CDM_MessageDriver)
|
||||
|
||||
//! a MessageDriver that writes nowhere.
|
||||
class CDM_NullMessageDriver : public CDM_MessageDriver
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Standard_EXPORT CDM_NullMessageDriver();
|
||||
|
||||
Standard_EXPORT void Write (const Standard_ExtString aString) Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(CDM_NullMessageDriver,CDM_MessageDriver)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _CDM_NullMessageDriver_HeaderFile
|
@@ -1,8 +1,6 @@
|
||||
CDM_Application.cxx
|
||||
CDM_Application.hxx
|
||||
CDM_CanCloseStatus.hxx
|
||||
CDM_COutMessageDriver.cxx
|
||||
CDM_COutMessageDriver.hxx
|
||||
CDM_DataMapIteratorOfMetaDataLookUpTable.hxx
|
||||
CDM_DataMapIteratorOfPresentationDirectory.hxx
|
||||
CDM_Document.cxx
|
||||
@@ -15,14 +13,10 @@ CDM_ListOfDocument.hxx
|
||||
CDM_ListOfReferences.hxx
|
||||
CDM_MapIteratorOfMapOfDocument.hxx
|
||||
CDM_MapOfDocument.hxx
|
||||
CDM_MessageDriver.cxx
|
||||
CDM_MessageDriver.hxx
|
||||
CDM_MetaData.cxx
|
||||
CDM_MetaData.hxx
|
||||
CDM_MetaDataLookUpTable.hxx
|
||||
CDM_NamesDirectory.hxx
|
||||
CDM_NullMessageDriver.cxx
|
||||
CDM_NullMessageDriver.hxx
|
||||
CDM_PresentationDirectory.hxx
|
||||
CDM_Reference.cxx
|
||||
CDM_Reference.hxx
|
||||
|
Reference in New Issue
Block a user