forked from ChunelFeng/CGraph
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCDescInfo.h
More file actions
76 lines (63 loc) · 1.46 KB
/
CDescInfo.h
File metadata and controls
76 lines (63 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/***************************
@Author: Chunel
@Contact: chunel@foxmail.com
@File: CDescInfo.h
@Time: 2023/2/19 15:56
@Desc: 通用描述信息
***************************/
#ifndef CGRAPH_CDESCINFO_H
#define CGRAPH_CDESCINFO_H
#include <string>
#include "CBasicDefine.h"
CGRAPH_NAMESPACE_BEGIN
class CDescInfo {
public:
/**
* 获取名称信息
* @return
*/
const std::string& getName() const {
return name_.empty() ? session_ : name_;
}
/**
* 获取唯一id信息
* @return
*/
const std::string& getSession() const {
return session_;
}
/**
* 获取描述信息
* @return
*/
const std::string& getDescription() const {
return description_;
}
/**
* 设置名称信息
* @param name
* @return
*/
virtual auto setName(const std::string& name)
-> decltype(this) {
name_ = name;
return this;
}
/**
* 设置描述信息
* @param description
* @return
*/
virtual auto setDescription(const std::string& description)
-> decltype(this) {
description_ = description;
return this;
}
virtual ~CDescInfo() = default;
protected:
std::string name_; // 名字
std::string session_; // 唯一id信息
std::string description_; // 描述信息
};
CGRAPH_NAMESPACE_END
#endif //CGRAPH_CDESCINFO_H