00001 00020 #ifndef ARXX_MERGE_H 00021 #define ARXX_MERGE_H 00022 00023 #include <assert.h> 00024 00025 #include <vector> 00026 00027 #include "Common.h" 00028 00041 namespace Arxx 00042 { 00043 class Archive; 00044 00045 class Item; 00046 00052 class Context 00053 { 00054 public: 00055 Context(Arxx::Archive & TargetArchive, Arxx::Archive & SourceArchive); 00056 Arxx::Item & GetCurrentItem(void) const; 00057 const Arxx::Archive & GetTargetArchive(void) const; 00058 const Arxx::Archive & GetSourceArchive(void) const; 00059 void vSetCurrentItem(Arxx::Item & Item); 00060 void vAddingItem(Arxx::Item & Item); 00061 void vAddItems(void); 00062 private: 00068 Arxx::Archive & m_TargetArchive; 00069 Arxx::Archive & m_SourceArchive; 00070 Arxx::Item * m_pCurrentItem; 00071 std::vector< Arxx::Item * > m_AddingItems; 00072 std::vector< Arxx::Item * > m_ReplaceItems; 00073 }; 00074 00085 enum Action 00086 { 00092 ADD, 00093 00099 REPLACE, 00100 DROP, 00101 PASS 00102 }; 00103 00109 class Rule 00110 { 00111 public: 00112 Rule(Arxx::Action Action) : 00113 m_Action(Action) 00114 { 00115 } 00116 00117 Rule(const Arxx::Rule & Rule) : 00118 m_Action(Rule.m_Action) 00119 { 00120 } 00121 00131 virtual bool bMatch(Arxx::Context & Context) const = 0; 00132 00133 virtual void vAct(Arxx::Context & Context) const 00134 { 00135 } 00136 00143 Arxx::Action GetAction(Arxx::Context & Context) const 00144 { 00145 vAct(Context); 00146 00147 return m_Action; 00148 } 00149 private: 00150 Arxx::Action m_Action; 00151 }; 00152 } 00153 00154 #endif