自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(69)
  • 收藏
  • 关注

原创 Linux文件操作常用函数

linux 文件常用操作

2022-07-27 09:35:21 481 1

原创 c++定义对象总结测试

#include <iostream>using namespace std;class AAA{public: int a; AAA() { std::cout << "AAA()" << std::endl; } AAA(int) { std::cout << "AAA(int)" << std::endl; }};int main(){ AAA aaa1;//AAA() AAA.

2021-05-11 23:10:07 115

原创 Ubuntu下显示Git仓库分支信息

1. vim ~/.bashrc2. 到最后一行写入如下代码#show the current git branch find_git_branch () { local dir=. head until [ "$dir" -ef / ]; do .

2021-04-23 19:53:05 366

原创 简单明了QComboBox

1. QComboBox * comboBox = new QComboBox()2. comboBox->addItem("文字项1");comboBox添加一项3. comboBox->addItem(QIcon(".PNG"), "文字项"); comboBox添加带文字的一项4. Signal::currentIndexChanged(int); comboBox改...

2020-04-07 10:38:18 196

原创 简单明了QCheckBox

1. QCheckBox * checkBox = new QCheckbox("标签内容", 父窗口)2. checkBox->checkState();被选择返回1,否则返回03. checkBox->setIcon(QIcon(":/*.png"));设置CheckBox文字前的图片,如下图...

2020-04-03 17:22:24 190

原创 常用的运算符优先级(由上至下)

逻辑运算符 NOT 符号 : !算数运算符 : * / %算数运算符 : + -关系运算符: < > <= >=关系运算符: == !=逻辑运算符 AND 符号 : &&逻辑运算符 OR 符号 : ||赋值运算符: ...

2019-12-19 09:33:55 1002

原创 Visual Studio 2017资源下载

Windows:Visual Studio 2017 Community :https://visualstudio.microsoft.com/zh-hans/thank-you-downloading-visual-studio/?sku=Community&rel=15Visual Studio 2017 Professional:https://visuals...

2019-12-13 08:39:54 328

原创 namespace

1. 命名空间作用防止命名冲突2. 命名空间常见的用法2.1 全局域中定义的名字被隐式的添加到全局命名空间中每个命名空间都是一个作用域#include <iostream>int a = 0;int main(){ int a = 0; ::a = 1; a = 2; //std::cout<<a<<s...

2019-11-20 10:44:55 106

原创 try...catch...流程图示

1. 语法形式before try codetry{ before throw; throw expection; after throw;}catch(expection1){}catch(expection2){}catch(expection3){}catch(...){}after try code2. 逻辑当try语句中...

2019-11-16 17:10:57 5242

原创 Interpret

#include <iostream>#include <map>#include <stack>using namespace std;class Expression{public: virtual int interpret(map<char, int>var) = 0; virtual ~Expression(...

2019-09-07 18:31:04 639

原创 Interpret(Reference:Design Patterns - Elements of Reusable Object-Oriented Software)

AbstractExpression--- 声明一个抽象的解释操作,这个接口为抽象语法树中所有的节点共享TerminalExpression--- 实现与文法中的终结符相关联的解释操作--- 一个句子中的每个终结符需要该类的一个实例NonterminalExpression--- 解析文法中的其他规则Context--- 包含解释器之外的一些全局信息...

2019-09-07 18:05:30 101

原创 Visitor

#include <iostream>using namespace std;class ElementA;class ElementB;class Visitor{public: virtual ~Visitor(){} virtual void visitElementA(ElementA & element) = 0; virt...

2019-09-07 17:54:04 121

原创 Visitor(Reference:Design Patterns - Elements of Reusable Object-Oriented Software)

Visitor--- 为对象结构中ConcreteElement的每一个类声明一个Visit操作!该操作的名字和特征标识了发送Visit请求给该访问者的类。使得访问者可以确定正在被访问元素的具体的类。这样访问者就可以通过该元素的特定接口直接访问它。ConcreteVisitor--- 实现每个由Visitor声明的操作。每个操作实现本算法的一部分,该算法是对应于结构中对象的类。Conc...

2019-09-07 17:41:46 125

原创 Command

#include <iostream>#include <vector>#include <string>using namespace std;class Receiver{public: virtual ~Receiver(){} virtual void action() = 0;};class Receive1 : ...

2019-09-07 16:58:46 107

原创 Command(Reference:Design Patterns - Elements of Reusable Object-Oriented Software)

Command--- 声明执行操作的接口ConcreteCommand--- 将一个接收者对象绑定与一个动作--- 调用接收者相应的操作,以实现Execute。Client--- 创建一个具体命令对象并设定它的接收者Invoker--- 要求该命令指向这个请求Receiver--- 知道如何实施与执行一个请求相关的操作。任何类都可能成为一个接收者。...

2019-09-07 16:34:59 70

原创 Iterator

#include <iostream>using namespace std;template<typename T>class Iterator{public: virtual ~Iterator(){} virtual void first() = 0; virtual void next() = 0; virtual bo...

2019-09-07 16:22:03 62

原创 Iterator(Reference:Design Patterns - Elements of Reusable Object-Oriented Software)

Iterator--- 迭代器定义访问和遍历元素的接口。ConcreteIterator--- 具体迭代器实现迭代器接口--- 对该聚合遍历时跟踪当前位置。Aggregate--- 聚合定义创建相应迭代器对象的接口。ConcreteAggregate--- 具体聚合实现创建相应迭代器的接口,该操作返回ConcreteIterator的一个适当的实例。...

2019-09-07 15:22:35 187

原创 ChainOfResponsibility

#include <iostream>using namespace std;enum Level{ Level_One = 1, Level_Two, Level_Three, Level_Four };class LevelRequest{public: LevelRequest(LevelRequest * levelRequest) : m_levelR...

2019-09-06 16:36:37 65

原创 ChainOfResponsibility(Reference:Design Patterns - Elements of Reusable Object-Oriented Software)

Handler--- 定义一个处理请求的接口--- (可选)实现后继链ConcreteHandler--- 处理它所负责的请求--- 可访问它的后继者--- 如果可处理该请求,就处理;否则将该请求转发给它的后继者。...

2019-09-06 15:59:49 85

原创 Composite

#include <iostream>#include <list>using namespace std;class Component{public: virtual ~Component(){} virtual void process() = 0;};class Leaf : public Component{public: ...

2019-09-06 15:49:30 131

原创 Composite(Reference:Design Patterns - Elements of Reusable Object-Oriented Software)

Component--- 为组合中的对象声明接口--- 在适当的情况下,实现所有类共有接口的缺省行为--- 声明一个接口用于访问和管理Component的子组件--- 在递归结构中定义一个接口,用于访问一个父部件,并在合适的情况下实现它Leaf--- 在组合中表示叶节点对象,叶节点没有子节点--- 在组合中定义图元对象的行为Composite--- 定义有子部件...

2019-09-06 14:22:40 154

原创 Memento

#include <iostream>using namespace std;typedef struct{ int information1; string information2; string information3;}MementoInformation;class Memento{public: Memento(){}...

2019-09-06 13:53:06 98

原创 Memento(Reference:Design Patterns - Elements of Reusable Object-Oriented Software)

Memento--- 备忘录存储Originator对象的内部状态。原发器根据需要决定备忘录存储原发器的哪些内部状态。--- 防止原发器以外的其他对象访问备忘录。备忘录实际上有两个接口,使用者只能看到备忘录的窄接口---它只能将备忘录传递给其他对象。相反,Originator能够看到一个宽接口,允许它访问返回到先前状态所需的所有数据。理想的情况是只允许生成本备忘录的内部状态。Origi...

2019-09-06 11:58:50 101

原创 State

#include <iostream>using namespace std;class Context;class State{public: virtual void doOperation(Context * context) = 0; virtual ~State(){}};class Context{public: Contex...

2019-09-06 11:34:59 111

原创 State(Reference:Design Patterns - Elements of Reusable Object-Oriented Software)

Context--- 定义客户感兴趣的接口--- 维护一个ConcreteState子类的实例,这个实例定义当前状态。State--- 定义一个接口以封装与Context的一个特定状态相关的行为ConcreteState subclasses--- 每一子类实现一个与Context的一个状态相关的行为...

2019-09-06 11:08:03 82

原创 Mediator(Reference:Design Patterns - Elements of Reusable Object-Oriented Software)

Mediator--- 中介者定义一个接口用于与各同事(Colleague)对象通信ConcreteMediator--- 具体中介者通过协调各同事对象实现协作行为--- 连接并维护它的各个同事Colleague class--- 每一个同事类都知道它的中介者对象--- 每一个同事对象在需要与其他同事通信的时候,与它的中介者通信...

2019-09-06 10:13:46 89

原创 Mediator

#include <iostream>using namespace std;class Mediator;//抽像交互类class Person{public: Person(Mediator * mediator) : m_pMediator(mediator){} virtual ~Person(){} virtual void se...

2019-09-06 10:13:27 109

原创 Adapter(Reference:Design Patterns - Elements of Reusable Object-Oriented Software)

Target--- 定义Client使用的与特定领域相关的接口。Client--- 与符合Target接口的对象协同Adaptee--- 定义一个已经存在的接口,这个接口需要适配Adapter--- 对Adaptee的接口与Target接口进行适配...

2019-09-05 16:13:20 68

原创 Adapter

#include <iostream>using namespace std;class A{public: virtual void Request() = 0; virtual ~A(){}};class ConcreteA1 : public A{public: void Request() override{ cout...

2019-09-05 16:09:23 66

原创 Proxy

#include <iostream>using namespace std;class A{public: virtual void Request() = 0; virtual ~A(){}};class ConcreteA1 : public A{public: void Request() override{ cout...

2019-09-05 15:23:33 150

原创 Proxy(Reference:Design Patterns - Elements of Reusable Object-Oriented Software)

Proxy--- 保存一个引用使得代理可以访问实体。若RealSubject和Subject的接口相同,Proxy会引用Subject--- 提供一个与Subject的接口相同的接口,这样代理就可以用来替代实体。--- 控制对实体的存取,并可能负责创建和删除它。Subject--- 定义RealSubject和Proxy的共用接口,这样就在任何使用RealSubject的地方都...

2019-09-05 14:58:38 113

原创 Facade

#include <iostream>using namespace std;class SubSystem1{public: void operation(){ cout<<"SubSystem1 Operation"<<endl; }};class SubSystem2{public: void operation(){ ...

2019-09-05 14:23:48 117

原创 Facade(Reference:Design Patterns - Elements of Reusable Object-Oriented Software)

Facade--- 知道哪些子系统类负责处理请求--- 将客户的请求代理给适当的子系统对象Subsystem classes--- 实现子系统的功能--- 处理由Facade对象指派的任务--- 没有Facade的任何相关信息。...

2019-09-05 14:06:17 109

原创 Flyweight

#include <iostream>#include <map>using namespace std;class Flyweight{public: Flyweight(const string & extrinsicState) : m_extrinsicState(extrinsicState){} virtual void setI...

2019-09-05 13:39:25 206

原创 Flyweight(Reference:Design Patterns - Elements of Reusable Object-Oriented Software)

Flyweight--- 描述一个接口,通过这个接口flyweight可以接受并作用于外部状态ConcreteFlyweight--- 实现Flyweight接口,并为内部状态(如果有的话)增加存储空间。ConcreteFlyweight对象必须是可共享的。它所存储的状态必须是内部的,即它必须独立于ConcreteFlyweight对象的场景。UnsharedConcreteFly...

2019-09-05 11:43:37 186

原创 Singleton

#include <iostream>using namespace std;class Singleton{public: static Singleton * Instance(); void operate(){ cout<<"One Operate"<<endl; }private: //私有化构造函数 Si...

2019-09-05 10:00:37 163

原创 Singleton(Reference:Design Patterns - Elements of Reusable Object-Oriented Software)

Singleton--- 定义一个Instance操作,允许客户访问它的唯一实例。Instance是一个类操作--- 可能负责创建它自己的唯一实例。

2019-09-05 09:39:39 117

原创 Builder

#include <iostream>using namespace std;class TextConverter{public: virtual void ConvertCharacter() = 0; virtual void ConvertFontChange() = 0; virtual ~TextConverter(){}};cl...

2019-09-04 15:45:12 109

原创 Builder(Reference:Design Patterns - Elements of Reusable Object-Oriented Software)

Builder--- 为创建一个Product对象的各个部件指定抽象接口ConcreteBuilder--- 实现Builder的接口以构造和装配该产品的各个部件--- 定义并跟踪它所创建的表示--- 提供一个检索产品的接口Director--- 构造一个使用Builder接口的对象Product--- 表示被构造的复杂对象。ConcreteBuilder创建该...

2019-09-04 14:51:48 205

原创 Prototype(Reference:Design Patterns - Elements of Reusable Object-Oriented Software)

Prototype--- 声明一个克隆自身的接口ConcretePrototype--- 实现一个克隆自身的操作Client--- 让一个原型克隆自身从而创建一个新的对象

2019-09-04 13:57:16 104

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除