Skip to content

Commit

Permalink
- VFS: Now takes app shutdown into account as earlier trigger for plu…
Browse files Browse the repository at this point in the history
…gin unloads to help with clean shutdowns

- CORE: Added some DataNode related classes related to upcoming restructure for data node plugins, not used yet
- GucefArchiver: Call app stop before exit to allow for a clean shutdown
  • Loading branch information
LiberatorUSA committed Aug 3, 2024
1 parent dfae103 commit 2b36a62
Show file tree
Hide file tree
Showing 16 changed files with 535 additions and 2 deletions.
2 changes: 2 additions & 0 deletions platform/gucefCORE/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ LOCAL_SRC_FILES := \
src/gucefCORE_CDStoreBinaryCodec.cpp \
src/gucefCORE_CDataNodeBinarySerializer.cpp \
src/gucefCORE_CDataNodeDefinition.cpp \
src/gucefCORE_CDataNodeDocumentBuilder.cpp \
src/gucefCORE_CDataNodeSerializableDataNode.cpp \
src/gucefCORE_CDataNodeSerializableSettings.cpp \
src/gucefCORE_CDate.cpp \
Expand All @@ -163,6 +164,7 @@ LOCAL_SRC_FILES := \
src/gucefCORE_CIDataNodeSerializableTaskData.cpp \
src/gucefCORE_CIDate.cpp \
src/gucefCORE_CIDirectoryWatcher.cpp \
src/gucefCORE_CIDocumentParserCallbacks.cpp \
src/gucefCORE_CIEnumerable.cpp \
src/gucefCORE_CIEventHandlerFunctorBase.cpp \
src/gucefCORE_CIFunction.cpp \
Expand Down
4 changes: 4 additions & 0 deletions platform/gucefCORE/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ set( HEADER_FILES
include/gucefCORE_CDStoreBinaryCodec.h
include/gucefCORE_CDataNodeBinarySerializer.h
include/gucefCORE_CDataNodeDefinition.h
include/gucefCORE_CDataNodeDocumentBuilder.h
include/gucefCORE_CDataNodeSerializableDataNode.h
include/gucefCORE_CDataNodeSerializableSettings.h
include/gucefCORE_CDate.h
Expand All @@ -171,6 +172,7 @@ set( HEADER_FILES
include/gucefCORE_CIDataNodeSerializableTaskData.h
include/gucefCORE_CIDate.h
include/gucefCORE_CIDirectoryWatcher.h
include/gucefCORE_CIDocumentParserCallbacks.h
include/gucefCORE_CIEnumerable.h
include/gucefCORE_CIEventHandlerFunctorBase.h
include/gucefCORE_CIFunction.h
Expand Down Expand Up @@ -388,6 +390,7 @@ set( SOURCE_FILES
src/gucefCORE_CDStoreBinaryCodec.cpp
src/gucefCORE_CDataNodeBinarySerializer.cpp
src/gucefCORE_CDataNodeDefinition.cpp
src/gucefCORE_CDataNodeDocumentBuilder.cpp
src/gucefCORE_CDataNodeSerializableDataNode.cpp
src/gucefCORE_CDataNodeSerializableSettings.cpp
src/gucefCORE_CDate.cpp
Expand All @@ -409,6 +412,7 @@ set( SOURCE_FILES
src/gucefCORE_CIDataNodeSerializableTaskData.cpp
src/gucefCORE_CIDate.cpp
src/gucefCORE_CIDirectoryWatcher.cpp
src/gucefCORE_CIDocumentParserCallbacks.cpp
src/gucefCORE_CIEnumerable.cpp
src/gucefCORE_CIEventHandlerFunctorBase.cpp
src/gucefCORE_CIFunction.cpp
Expand Down
4 changes: 2 additions & 2 deletions platform/gucefCORE/include/CDataNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ class GUCEF_CORE_PUBLIC_CPP CDataNode : public CIEnumerable
{
public:

typedef std::vector< CString, gucef_allocator< CString > > TStringVector;
typedef std::set< CString, std::less< CString >, gucef_allocator< CString > > TStringSet;
typedef CString::StringVector TStringVector;
typedef CString::StringSet TStringSet;
typedef std::pair< const CString, CVariant > TKeyValuePair;
typedef std::set< CDataNode*, std::less< CDataNode* >, gucef_allocator< CDataNode* > > TDataNodeSet;
typedef std::list< CDataNode*, gucef_allocator< CDataNode* > > TDataNodeList;
Expand Down
95 changes: 95 additions & 0 deletions platform/gucefCORE/include/gucefCORE_CDataNodeDocumentBuilder.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/*
* gucefCORE: GUCEF module providing O/S abstraction and generic solutions
*
* Copyright (C) 1998 - 2024. Dinand Vanvelzen
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef GUCEF_CORE_CDATANODEDOCUMENTBUILDER_H
#define GUCEF_CORE_CDATANODEDOCUMENTBUILDER_H

/*-------------------------------------------------------------------------//
// //
// INCLUDES //
// //
//-------------------------------------------------------------------------*/

#ifndef GUCEF_CORE_CIDOCUMENTPARSERCALLBACKS_H
#include "gucefCORE_CIDocumentParserCallbacks.h"
#define GUCEF_CORE_CIDOCUMENTPARSERCALLBACKS_H
#endif /* GUCEF_CORE_CIDOCUMENTPARSERCALLBACKS_H ? */

#ifndef GUCEF_CORE_CDATANODE_H
#include "CDataNode.h"
#define GUCEF_CORE_CDATANODE_H
#endif /* GUCEF_CORE_CDATANODE_H ? */

/*-------------------------------------------------------------------------//
// //
// NAMESPACE //
// //
//-------------------------------------------------------------------------*/

namespace GUCEF {
namespace CORE {

/*-------------------------------------------------------------------------//
// //
// CLASSES //
// //
//-------------------------------------------------------------------------*/

/**
* Implementation which uses document parser callbacks to contruct a DataNode class based tree
*/
class GUCEF_CORE_PUBLIC_CPP CDataNodeDocumentBuilder : public CIDocumentParserCallbacks
{
public:

CDataNodeDocumentBuilder( void );
CDataNodeDocumentBuilder( const CDataNodeDocumentBuilder& src );
virtual ~CDataNodeDocumentBuilder();
CDataNodeDocumentBuilder& operator=( const CDataNodeDocumentBuilder& src );

virtual void OnDocumentBegin( void ) GUCEF_VIRTUAL_OVERRIDE;
virtual void OnDocumentEnd( void ) GUCEF_VIRTUAL_OVERRIDE;
virtual void OnNodeBegin( const CVariant& nodeId, int nodeType ) GUCEF_VIRTUAL_OVERRIDE;
virtual void OnNodeEnd( const CVariant& nodeId ) GUCEF_VIRTUAL_OVERRIDE;
virtual void OnNodeAttribute( const CVariant& nodeId, const CVariant& attributeId, const CVariant& attributeValue ) GUCEF_VIRTUAL_OVERRIDE;
virtual void OnNodeValue( const CVariant& nodeId, const CVariant& nodeValue ) GUCEF_VIRTUAL_OVERRIDE;
virtual void OnNodeChildrenBegin( const CVariant& nodeId ) GUCEF_VIRTUAL_OVERRIDE;
virtual void OnNodeChildrenEnd( const CVariant& nodeId ) GUCEF_VIRTUAL_OVERRIDE;
virtual void OnParseError( Int32 errorCode, const CString& description ) GUCEF_VIRTUAL_OVERRIDE;

CDataNode document;

private:

CDataNode* m_nodeCursor;
};

/*-------------------------------------------------------------------------//
// //
// NAMESPACE //
// //
//-------------------------------------------------------------------------*/

}; /* namespace CORE */
}; /* namespace GUCEF */

/*-------------------------------------------------------------------------*/

#endif /* GUCEF_CORE_CDATANODEDOCUMENTBUILDER_H ? */

/*-------------------------------------------------------------------------*/
95 changes: 95 additions & 0 deletions platform/gucefCORE/include/gucefCORE_CIDocumentParserCallbacks.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/*
* gucefCORE: GUCEF module providing O/S abstraction and generic solutions
*
* Copyright (C) 1998 - 2024. Dinand Vanvelzen
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef GUCEF_CORE_CIDOCUMENTPARSERCALLBACKS_H
#define GUCEF_CORE_CIDOCUMENTPARSERCALLBACKS_H

/*-------------------------------------------------------------------------//
// //
// INCLUDES //
// //
//-------------------------------------------------------------------------*/

#ifndef GUCEF_CORE_CSTRING_H
#include "gucefCORE_CString.h" /* framework string implementation */
#define GUCEF_CORE_CSTRING_H
#endif /* GUCEF_CORE_CSTRING_H ? */

#ifndef GUCEF_CORE_CVARIANT_H
#include "gucefCORE_CVariant.h" /* framework variant implementation */
#define GUCEF_CORE_CVARIANT_H
#endif /* GUCEF_CORE_CVARIANT_H ? */

/*-------------------------------------------------------------------------//
// //
// NAMESPACE //
// //
//-------------------------------------------------------------------------*/

namespace GUCEF {
namespace CORE {

/*-------------------------------------------------------------------------//
// //
// CLASSES //
// //
//-------------------------------------------------------------------------*/

/**
* Interface class for document parse callbacks
* In XML lingo these are referred to as SAX parsers
*
* Implementing this type of interface allows you to interpret a varied range of schema formats
* due to the abstraction provided. You dont need to know if you are dealing with a JSON or XML or YAML or whatever document
* What matters is the information contained within the document itself, which can be accessed through this type of parser
*/
class GUCEF_CORE_PUBLIC_CPP CIDocumentParserCallbacks
{
public:

CIDocumentParserCallbacks( void );
CIDocumentParserCallbacks( const CIDocumentParserCallbacks& src );
virtual ~CIDocumentParserCallbacks();
CIDocumentParserCallbacks& operator=( const CIDocumentParserCallbacks& src );

virtual void OnDocumentBegin( void ) = 0;
virtual void OnDocumentEnd( void ) = 0;
virtual void OnNodeBegin( const CVariant& nodeId, int nodeType ) = 0;
virtual void OnNodeEnd( const CVariant& nodeId ) = 0;
virtual void OnNodeAttribute( const CVariant& nodeId, const CVariant& attributeId, const CVariant& attributeValue ) = 0;
virtual void OnNodeValue( const CVariant& nodeId, const CVariant& nodeValue ) = 0;
virtual void OnNodeChildrenBegin( const CVariant& nodeId ) = 0;
virtual void OnNodeChildrenEnd( const CVariant& nodeId ) = 0;
virtual void OnParseError( Int32 errorCode, const CString& description ) = 0;

};

/*-------------------------------------------------------------------------//
// //
// NAMESPACE //
// //
//-------------------------------------------------------------------------*/

}; /* namespace CORE */
}; /* namespace GUCEF */

/*-------------------------------------------------------------------------*/

#endif /* GUCEF_CORE_CIDOCUMENTPARSERCALLBACKS_H ? */

/*-------------------------------------------------------------------------*/
4 changes: 4 additions & 0 deletions platform/gucefCORE/premake4.lua
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ files( {
"include/gucefCORE_CDStoreBinaryCodec.h",
"include/gucefCORE_CDataNodeBinarySerializer.h",
"include/gucefCORE_CDataNodeDefinition.h",
"include/gucefCORE_CDataNodeDocumentBuilder.h",
"include/gucefCORE_CDataNodeSerializableDataNode.h",
"include/gucefCORE_CDataNodeSerializableSettings.h",
"include/gucefCORE_CDate.h",
Expand All @@ -204,6 +205,7 @@ files( {
"include/gucefCORE_CIDataNodeSerializableTaskData.h",
"include/gucefCORE_CIDate.h",
"include/gucefCORE_CIDirectoryWatcher.h",
"include/gucefCORE_CIDocumentParserCallbacks.h",
"include/gucefCORE_CIEnumerable.h",
"include/gucefCORE_CIEventHandlerFunctorBase.h",
"include/gucefCORE_CIFunction.h",
Expand Down Expand Up @@ -425,6 +427,7 @@ files( {
"src/gucefCORE_CDStoreBinaryCodec.cpp",
"src/gucefCORE_CDataNodeBinarySerializer.cpp",
"src/gucefCORE_CDataNodeDefinition.cpp",
"src/gucefCORE_CDataNodeDocumentBuilder.cpp",
"src/gucefCORE_CDataNodeSerializableDataNode.cpp",
"src/gucefCORE_CDataNodeSerializableSettings.cpp",
"src/gucefCORE_CDate.cpp",
Expand All @@ -446,6 +449,7 @@ files( {
"src/gucefCORE_CIDataNodeSerializableTaskData.cpp",
"src/gucefCORE_CIDate.cpp",
"src/gucefCORE_CIDirectoryWatcher.cpp",
"src/gucefCORE_CIDocumentParserCallbacks.cpp",
"src/gucefCORE_CIEnumerable.cpp",
"src/gucefCORE_CIEventHandlerFunctorBase.cpp",
"src/gucefCORE_CIFunction.cpp",
Expand Down
4 changes: 4 additions & 0 deletions platform/gucefCORE/premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ files( {
"include/gucefCORE_CDStoreBinaryCodec.h",
"include/gucefCORE_CDataNodeBinarySerializer.h",
"include/gucefCORE_CDataNodeDefinition.h",
"include/gucefCORE_CDataNodeDocumentBuilder.h",
"include/gucefCORE_CDataNodeSerializableDataNode.h",
"include/gucefCORE_CDataNodeSerializableSettings.h",
"include/gucefCORE_CDate.h",
Expand All @@ -204,6 +205,7 @@ files( {
"include/gucefCORE_CIDataNodeSerializableTaskData.h",
"include/gucefCORE_CIDate.h",
"include/gucefCORE_CIDirectoryWatcher.h",
"include/gucefCORE_CIDocumentParserCallbacks.h",
"include/gucefCORE_CIEnumerable.h",
"include/gucefCORE_CIEventHandlerFunctorBase.h",
"include/gucefCORE_CIFunction.h",
Expand Down Expand Up @@ -425,6 +427,7 @@ files( {
"src/gucefCORE_CDStoreBinaryCodec.cpp",
"src/gucefCORE_CDataNodeBinarySerializer.cpp",
"src/gucefCORE_CDataNodeDefinition.cpp",
"src/gucefCORE_CDataNodeDocumentBuilder.cpp",
"src/gucefCORE_CDataNodeSerializableDataNode.cpp",
"src/gucefCORE_CDataNodeSerializableSettings.cpp",
"src/gucefCORE_CDate.cpp",
Expand All @@ -446,6 +449,7 @@ files( {
"src/gucefCORE_CIDataNodeSerializableTaskData.cpp",
"src/gucefCORE_CIDate.cpp",
"src/gucefCORE_CIDirectoryWatcher.cpp",
"src/gucefCORE_CIDocumentParserCallbacks.cpp",
"src/gucefCORE_CIEnumerable.cpp",
"src/gucefCORE_CIEventHandlerFunctorBase.cpp",
"src/gucefCORE_CIFunction.cpp",
Expand Down
Loading

0 comments on commit 2b36a62

Please sign in to comment.