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

Commit756fc74

Browse files
Move getting PgPolygon to the stamp concept
1 parentec37149 commit756fc74

File tree

3 files changed

+73
-25
lines changed

3 files changed

+73
-25
lines changed

‎libblobstamper.cpp‎

Lines changed: 40 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include<stdlib.h>
44

55
#include<string>
6+
#include<list>
67

78
#include"libblobstamper.h"
89

@@ -117,28 +118,33 @@ Blob::ShiftSingleStampStr(StampGeneric& stmp)
117118
return stmp.ExtractStr(*this);
118119
}
119120

120-
std::string
121-
wflShiftPgPath(Blob &blob)
121+
/*************************************************************************************/
122+
123+
std::list<std::string>StampList::ExtractStrList(Blob &blob)
122124
{
123-
std::string res ="";
124-
StampStrPgPoint stamp_pg_point;
125+
std::list<std::string> res;
126+
127+
if (target_stamp.isFixedSize())
128+
{
125129
while (1)
126130
{
127-
std::string point = blob.ShiftSingleStampStr(stamp_pg_point);
128-
if (point.empty())
129-
break;
130-
if (!res.empty()) res = res +",";
131-
res = res + point;
131+
std::string el = blob.ShiftSingleStampStr(target_stamp);
132+
if (el.empty())
133+
break;
134+
res.push_back(el);
132135
}
133-
if (res.empty())
134-
return res;
135-
res ="(" + res +")";
136-
return res;
136+
}
137+
else
138+
{
139+
printf("Not implemented yet!");
140+
exit(1);
141+
}
142+
143+
return res;
137144
}
138145

139-
/*************************************************************************************/
140146

141-
StampBinDouble::StampBinDouble()
147+
StampBinDouble::StampBinDouble() : StampGeneric()
142148
{
143149
min_size =sizeof(double);
144150
max_size =sizeof(double);
@@ -194,7 +200,7 @@ StampStrDouble::ExtractStr(Blob &blob)
194200
}
195201
/* ----*/
196202

197-
StampStrPgPoint::StampStrPgPoint()
203+
StampStrPgPoint::StampStrPgPoint() : StampGeneric()
198204
{
199205
min_size = stamp_double.minSize() *2;
200206
max_size = stamp_double.maxSize() *2;
@@ -218,3 +224,21 @@ StampStrPgPoint::ExtractStr(Blob &blob)
218224
return res;
219225
}
220226

227+
228+
std::string
229+
StampStrPgPolygon::ExtractStr(Blob &blob)
230+
{
231+
std::string res ="";
232+
std::list<std::string> list =ExtractStrList(blob);
233+
234+
235+
for (std::string point : list) {
236+
if (!res.empty()) res = res +",";
237+
res = res + point;
238+
}
239+
240+
if (res.empty())
241+
return res;
242+
res ="(" + res +")";
243+
return res;
244+
}

‎libblobstamper.h‎

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11

2-
#include<string>
32
#include<stdio.h>
43

4+
#include<string>
5+
#include<list>
6+
57
classStampGeneric;
68

79
classBlob
@@ -38,23 +40,32 @@ class StampGeneric
3840

3941
};
4042

43+
classStampList:publicStampGeneric
44+
{
45+
protected:
46+
StampGeneric& target_stamp;
47+
public:
48+
StampList(StampGeneric &stamp) : target_stamp(stamp) {};
49+
50+
virtual std::list<std::string>ExtractStrList(Blob &blob);
51+
52+
53+
};
54+
55+
4156
classStampBinDouble:publicStampGeneric
4257
{
4358
public:
4459
StampBinDouble();
4560
void *Extract(Blob &blob)override;
46-
47-
4861
};
4962

5063

5164
classStampStrDouble:publicStampBinDouble
5265
{
5366
public:
54-
// StampStrDouble();
5567
StampStrDouble() : StampBinDouble() {}
56-
57-
std::stringExtractStr(Blob &blob)override;
68+
std::stringExtractStr(Blob &blob)override;
5869

5970
};
6071

@@ -68,6 +79,16 @@ class StampStrPgPoint: public StampGeneric
6879
std::stringExtractStr(Blob &blob)override;
6980
};
7081

82+
classStampStrPgPolygon:publicStampList
83+
{
84+
StampStrPgPoint actual_stamp;/*Запутался я нафиг с этими указателями. Пусть будет пока так, потом разберемся как правильно, все равно оно под капотом...*/
85+
public:
86+
StampStrPgPolygon() : StampList(actual_stamp) {}
87+
std::stringExtractStr(Blob &blob)override;
88+
};
89+
90+
91+
7192
BlobwflShiftN(Blob &blob,size_t n);
7293
std::stringwflShiftDouble(Blob &blob);
7394
std::stringwflShiftPgPoint(Blob &blob);

‎test_libblobstamper.cpp‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ main(void)
4040
free(res);
4141

4242
StampStrDouble stmp_str_double;
43-
43+
4444
std::string str = bl.ShiftSingleStampStr(stmp_str_double);
4545

4646
printf("-------- %s\n", str.c_str());
@@ -51,9 +51,12 @@ main(void)
5151

5252
printf("======= %s\n", str.c_str());
5353

54-
str =wflShiftPgPath(bl);
5554

56-
printf("++++++++ %s\n", str.c_str());
55+
StampStrPgPolygon stmp_pg_poligon;
56+
57+
str = bl.ShiftSingleStampStr(stmp_pg_poligon);
58+
59+
printf("_________ %s\n", str.c_str());
5760

5861

5962

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp