Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita6d0eef

Browse files
Add String Enumeratior stamp
1 parent47278eb commita6d0eef

File tree

6 files changed

+16
-85
lines changed

6 files changed

+16
-85
lines changed

‎blobstamper/Makefile

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,14 @@
11

2-
ALL_OBJS = blob.o\
3-
helpers.o\
4-
stamp.o\
5-
stamp_arithm.o\
6-
stamp_dict.o\
7-
galley.o\
8-
dict.o\
92

3+
BLOBSTAMPER_SRC :=$(wildcard ./*.cpp)
4+
BLOBSTAMPER_OBJ :=$(addsuffix .o,$(basename$(BLOBSTAMPER_SRC)))
105

11-
%.o:%.cpp$(DEPS)
12-
$(CXX) -c -g$(CXXFLAGS)$<
136

14-
%.o:%.c$(DEPS)
15-
$(CC) -c -g$(CFLAGS)$<
7+
%.o:%.cpp
8+
$(CXX) -c -g$(CXXFLAGS) -I ..$< -o$@
169

1710

18-
all:$(ALL_OBJS)
11+
all:$(BLOBSTAMPER_OBJ)
1912

2013
.PHONY: clean
2114
clean:

‎blobstamper/blobstamper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@
2222
#include"stamp_dict.h"
2323
#include"dict.h"
2424
#include"galley.h"
25-
25+
#include"stamp_enumerator.h"
2626

‎blobstamper/galley.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
#include<vector>
2525
#include<functional>// for std::reference_wrapper
2626

27+
#include"stamp.h"
28+
#include"blob.h"
29+
30+
2731
#defineORACLE_TYPEunsignedshortint
2832
#defineORACLE_STAMP StampArithm<ORACLE_TYPE>
2933
#defineORACLE_SIZEsizeof(ORACLE_TYPE)
@@ -33,6 +37,7 @@ class GalleyBase: public virtual StampBase
3337
/* Galley is a kind of stamp, somwhere deep inside.*/
3438
/* You can inherit it, and make a stamp out of it*/
3539
{
40+
3641
};
3742

3843
classGalleyVectorBase :publicGalleyBase

‎blobstamper/stamp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include<memory>
2626

2727
#include"helpers.h"
28+
#include"blob.h"
2829

2930

3031
classStampBase

‎examples/Makefile

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,6 @@ all: $(EXAMPLES_BIN)
1111
build-libtappp:
1212
$(MAKE) -C ../libtappp
1313

14-
../blobstamper-pg/%.o: ../blobstamper-pg/%.cpp
15-
$(CXX) -c -g$(CXXFLAGS) -I ..$< -o$@
16-
17-
../wrappers/%.o: ../wrappers/%.cpp
18-
$(CXX) -c -g$(CXXFLAGS) -I ..$< -o$@
19-
20-
2114
%:%.cpp$(BLOBSTAMPER_OBJ)$(BLOBSTAMPER_PG_OBJ)$(WRAPPERS_OBJ)
2215
$(CXX)$(CXXFLAGS) -I.. -o$@$<$(BLOBSTAMPER_OBJ)
2316

‎examples/example08.cpp

Lines changed: 4 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -53,86 +53,25 @@ Point3D StampPoint3D::ExtractValue(Blob &blob)
5353
}
5454

5555

56-
classStampPolyLine3D:publicGalleyVectorStr,publicStampBaseStr
56+
classStampPolyLine3D:publicStampStrEnumerator
5757
{
5858
protected:
5959
StampPoint3D * item_stamp_p;
6060
public:
61-
StampPolyLine3D():GalleyVectorStr(*(item_stamp_p =new StampPoint3D())) {};
61+
StampPolyLine3D():StampStrEnumerator(*(item_stamp_p =new StampPoint3D()),",","(",")") {};
6262
~StampPolyLine3D() {delete item_stamp_p;};
63-
64-
virtual std::stringExtractStr(Blob &blob)override;
65-
};
66-
67-
classStampStrEnumerator:publicGalleyVectorStr,publicStampBaseStr
68-
{
69-
protected:
70-
StampBaseStr & stamp_str;
71-
const std::string separator;
72-
const std::string left_bracket;
73-
const std::string right_bracket;
74-
public:
75-
StampStrEnumerator(StampBaseStr &arg_stamp,
76-
const std::string arg_sep,
77-
const std::string arg_l,
78-
const std::string arg_r
79-
):
80-
stamp_str(arg_stamp),
81-
separator(arg_sep),
82-
left_bracket(arg_l),
83-
right_bracket(arg_r),
84-
GalleyVectorStr(arg_stamp) {};
85-
86-
virtual std::stringExtractStr(Blob &blob)override;
87-
8863
};
8964

9065

91-
std::stringStampStrEnumerator::ExtractStr(Blob &blob)
92-
{
93-
std::vector<std::string> data =ExtractStrVector(blob);
94-
std::string res ="";
95-
96-
for(std::string s : data)
97-
{
98-
if (!res.empty())
99-
{
100-
res+= separator;
101-
}
102-
res+= s;
103-
}
104-
res = left_bracket + res + right_bracket;
105-
return res;
106-
}
107-
108-
109-
110-
std::stringStampPolyLine3D::ExtractStr(Blob &blob)
111-
{
112-
std::vector<std::string> data =ExtractStrVector(blob);
113-
std::string res ="";
114-
115-
for(std::string s : data)
116-
{
117-
if (!res.empty())
118-
{
119-
res+=",";
120-
}
121-
res+= s;
122-
}
123-
res ="(" + res +")";
124-
return res;
125-
}
12666

12767
intmain()
12868
{
12969
char data[] ="abcdef""abcdef""ABCDEF""012345";
13070
Blobblob(data,strlen(data));
131-
StampPoint3D stamp;
13271

133-
StampStrEnumeratorstamp_e(stamp," -","[","]");
72+
StampPolyLine3Dstamp;
13473

13574

136-
std::string s =stamp_e.ExtractStr(blob);
75+
std::string s =stamp.ExtractStr(blob);
13776
std::cout << s <<"\n";
13877
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp