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

Commitdef0e05

Browse files
Introduce galley concept; move shifting lint or galley, and now call it shifting sereies
1 parentde236fd commitdef0e05

File tree

5 files changed

+48
-29
lines changed

5 files changed

+48
-29
lines changed

‎blobstamper/blob.cpp‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,30 @@ Blob::DataDup(char *& data_out, size_t& size_out)
7676
memcpy(data_out, data + begin, size_out);
7777
}
7878

79+
80+
std::list<std::string>
81+
GalleySeries::Extract(Blob &blob)
82+
{
83+
std::list<std::string> res;
84+
85+
if (stamp.isFixedSize())
86+
{
87+
while (1)
88+
{
89+
std::string el = blob.ShiftSingleStampStr(stamp);
90+
if (el.empty())
91+
break;
92+
res.push_back(el);
93+
}
94+
}
95+
else
96+
{
97+
printf("Not implemented yet!");
98+
exit(1);
99+
}
100+
101+
return res;
102+
}
103+
104+
105+

‎blobstamper/blob.h‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#defineBLOB_H
44

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

78
classStampGeneric;
89

@@ -25,4 +26,19 @@ class Blob
2526
std::stringShiftSingleStampStr(StampGeneric &stmp);
2627
};
2728

29+
classGalleyBase
30+
{
31+
32+
};
33+
34+
classGalleySeries :publicGalleyBase
35+
{
36+
protected:
37+
StampGeneric &stamp;
38+
public:
39+
GalleySeries(StampGeneric & stamp_arg) : stamp(stamp_arg) {};
40+
std::list<std::string>Extract(Blob &blob);
41+
};
42+
43+
2844
#endif/*BLOB_H*/

‎blobstamper/stamp.cpp‎

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -29,27 +29,3 @@ StampGeneric::Extract(Blob &blob)
2929
return (void *) res;
3030
}
3131

32-
33-
std::list<std::string>StampList::ExtractStrList(Blob &blob)
34-
{
35-
std::list<std::string> res;
36-
37-
if (target_stamp.isFixedSize())
38-
{
39-
while (1)
40-
{
41-
std::string el = blob.ShiftSingleStampStr(target_stamp);
42-
if (el.empty())
43-
break;
44-
res.push_back(el);
45-
}
46-
}
47-
else
48-
{
49-
printf("Not implemented yet!");
50-
exit(1);
51-
}
52-
53-
return res;
54-
}
55-

‎blobstamper/stamp.h‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ class StampList: public StampGeneric
2727
StampGeneric& target_stamp;
2828
public:
2929
StampList(StampGeneric &stamp) : target_stamp(stamp) {};
30-
31-
virtual std::list<std::string>ExtractStrList(Blob &blob);
32-
33-
3430
};
3531

3632
#endif/* STAMP_H*/

‎t/100-stamp-base.cpp‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ main()
6666
char *ptr;
6767
size_t size;
6868

69-
TEST_START(8);
69+
TEST_START(4);
7070

7171
/* Test that ShiftSingleStampStr shifts ok with StampTwoChars stamp*/
7272
{/* 1..3*/
@@ -85,6 +85,8 @@ main()
8585
free(ptr);
8686
}
8787

88+
/* This should be moved to Galley test later*/
89+
#if0
8890
/* Test that StamList really splits the whole blob to the specified stamps */
8991
{ /* 4..7 */
9092
std::string expected1 = "12";
@@ -112,6 +114,8 @@ main()
112114

113115
ok(res.empty(), "ExtractStrList: The rest of the list is empty");
114116
}
117+
#endif
118+
115119
/* Chekc that data is shifted till blob data is empty*/
116120
{/* 8*/
117121
char sample_two_bytes[]="12";

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp