添加命令模式

master
caiyuzheng 2020-05-28 23:20:38 +08:00
parent 176b1073c6
commit b9c99ae265
3 changed files with 34 additions and 21 deletions

View File

@ -30,11 +30,10 @@
</component>
<component name="ChangeListManager">
<list default="true" id="0facce0d-c642-4d80-b2fb-daf5f3e68dff" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/general/src/pattern/cmd.hpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/general/CMakeLists.txt" beforeDir="false" afterPath="$PROJECT_DIR$/general/CMakeLists.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/general/src/pattern/adapter.hpp" beforeDir="false" afterPath="$PROJECT_DIR$/general/src/ b-+/adapter.hpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/general/src/encrypt/aes.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/general/src/encrypt/aes.cpp" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
@ -90,20 +89,8 @@
<recent name="D:\project\c++\generallib\src\encrypt" />
</key>
</component>
<component name="RunDashboard">
<option name="ruleStates">
<list>
<RuleState>
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
</RuleState>
<RuleState>
<option name="name" value="StatusDashboardGroupingRule" />
</RuleState>
</list>
</option>
</component>
<component name="RunManager">
<configuration name="General" type="CMakeRunConfiguration" factoryName="Application" PASS_PARENT_ENVS_2="true" PROJECT_NAME="General" TARGET_NAME="General" CONFIG_NAME="Debug">
<configuration name="General" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="General" TARGET_NAME="General" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
@ -171,24 +158,25 @@
<workItem from="1589096335715" duration="9622000" />
<workItem from="1589465397742" duration="4077000" />
<workItem from="1590041861831" duration="3306000" />
<workItem from="1590548574620" duration="180000" />
<workItem from="1590676222894" duration="1966000" />
</task>
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="1" />
<option name="version" value="2" />
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State>
<option name="COLUMN_ORDER" />
</State>
<State />
</value>
</entry>
</map>
</option>
<option name="oldMeFiltersMigrated" value="true" />
</component>
<component name="WindowStateProjectService">
<state x="361" y="110" key="#New_File_Extensions" timestamp="1589793685936">

View File

@ -1131,6 +1131,6 @@ void AES::Decrypt(char const* in, char* result, size_t n, int iMode)
pin += m_blockSize;
presult += m_blockSize;
}
}
}
}

View File

@ -0,0 +1,25 @@
#define GENERAL_CMD_H
#include <vector>
template<typename T>
class Command{
public:
virtual int excute(T){
return 0;
}
};
template<typename T>
class CommandBroker{
public:
void AddCommand(Command order){
}
void DoCommand(){
for (Order order : orderList) {
order.execute();
}
orderList.clear();
}
private:
std::vector<Command> mCommands;
};
#endif