Skip to content

Commit ca0e5c3

Browse files
authored
Target insert API (#160)
1 parent 8b77ec3 commit ca0e5c3

File tree

15 files changed

+654
-330
lines changed

15 files changed

+654
-330
lines changed

buildcc/lib/target/cmake/common_target_src.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ set(COMMON_TARGET_SRCS
3131
include/target/api/flag_api.h
3232
include/target/api/deps_api.h
3333

34-
src/api/copy_api.cpp
35-
include/target/api/copy_api.h
34+
src/api/sync_api.cpp
35+
include/target/api/sync_api.h
3636

3737
src/api/target_info_getter.cpp
3838
src/api/target_getter.cpp

buildcc/lib/target/include/target/api/copy_api.h renamed to buildcc/lib/target/include/target/api/sync_api.h

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
* limitations under the License.
1515
*/
1616

17-
#ifndef TARGET_API_COPY_API_H_
18-
#define TARGET_API_COPY_API_H_
17+
#ifndef TARGET_API_SYNC_API_H_
18+
#define TARGET_API_SYNC_API_H_
1919

2020
#include <initializer_list>
2121

2222
namespace buildcc::base {
2323

24-
enum class CopyOption {
24+
enum class SyncOption {
2525
SourceFiles,
2626
HeaderFiles,
2727
PchFiles,
@@ -44,29 +44,44 @@ enum class CopyOption {
4444
// Requires
4545
// - TargetStorer
4646
// - TargetState
47-
template <typename T> class CopyApi {
47+
template <typename T> class SyncApi {
4848
public:
4949
/**
50-
* @brief Copy when Target supplied by const reference
50+
* @brief Copy/Replace selected variables when Target supplied by const
51+
* reference
5152
*/
52-
void Copy(const T &target, std::initializer_list<CopyOption> options);
53+
void Copy(const T &target, std::initializer_list<SyncOption> options);
5354

5455
/**
55-
* @brief Copy when Target supplied by move
56+
* @brief Copy/Replace selected variables when Target supplied by move
5657
*/
57-
void Copy(T &&target, std::initializer_list<CopyOption> options);
58+
void Copy(T &&target, std::initializer_list<SyncOption> options);
59+
60+
/**
61+
* @brief Insert selected variables when Target supplied by const reference
62+
*/
63+
void Insert(const T &target, std::initializer_list<SyncOption> options);
64+
65+
/**
66+
* @brief Insert selected variables when Target supplied by move
67+
*
68+
*/
69+
void Insert(T &&target, std::initializer_list<SyncOption> options);
5870

5971
private:
6072
template <typename TargetType>
6173
void SpecializedCopy(TargetType target,
62-
std::initializer_list<CopyOption> options);
74+
std::initializer_list<SyncOption> options);
75+
template <typename TargetType>
76+
void SpecializedInsert(TargetType target,
77+
std::initializer_list<SyncOption> options);
6378
};
6479

6580
} // namespace buildcc::base
6681

6782
namespace buildcc {
6883

69-
typedef base::CopyOption CopyOption;
84+
typedef base::SyncOption SyncOption;
7085

7186
}
7287

buildcc/lib/target/include/target/generator.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,4 +138,10 @@ class Generator : public BuilderInterface {
138138

139139
} // namespace buildcc::base
140140

141+
namespace buildcc {
142+
143+
typedef base::Generator BaseGenerator;
144+
145+
}
146+
141147
#endif

buildcc/lib/target/include/target/target_info.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@
2424
#include "target/common/target_env.h"
2525
#include "target/common/target_state.h"
2626

27-
#include "target/api/copy_api.h"
2827
#include "target/api/deps_api.h"
2928
#include "target/api/flag_api.h"
3029
#include "target/api/include_api.h"
3130
#include "target/api/lib_api.h"
3231
#include "target/api/pch_api.h"
32+
#include "target/api/sync_api.h"
3333

3434
#include "target/api/source_api.h"
3535

@@ -47,7 +47,7 @@ class TargetInfo : public SourceApi<TargetInfo>,
4747
public PchApi<TargetInfo>,
4848
public FlagApi<TargetInfo>,
4949
public DepsApi<TargetInfo>,
50-
public CopyApi<TargetInfo>,
50+
public SyncApi<TargetInfo>,
5151
public TargetInfoGetter<TargetInfo> {
5252
public:
5353
TargetInfo(const TargetEnv &env, const TargetConfig &config = TargetConfig())
@@ -63,7 +63,7 @@ class TargetInfo : public SourceApi<TargetInfo>,
6363
friend class DepsApi<TargetInfo>;
6464

6565
// Feature
66-
friend class CopyApi<TargetInfo>;
66+
friend class SyncApi<TargetInfo>;
6767

6868
// Getters
6969
friend class TargetInfoGetter<TargetInfo>;

buildcc/lib/target/src/api/copy_api.cpp

Lines changed: 0 additions & 121 deletions
This file was deleted.

0 commit comments

Comments
 (0)