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

Commitf7d4fdf

Browse files
Introduce dict class
1 parent88d6e72 commitf7d4fdf

File tree

6 files changed

+360
-3
lines changed

6 files changed

+360
-3
lines changed

‎Makefile‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@ blobstamper/helpers.o \
1111
blobstamper/stamp.o\
1212
blobstamper/stamp_atomic.o\
1313
blobstamper/stamp_pg_type_geo.o\
14+
blobstamper/dict.o\
1415

1516
WRAPPERS_OBJ = pg_op_wrappers.o
1617

1718

1819
.PHONY: all blob-stamper-all blob-stamper-clean clean test
19-
all: blob-stamper-all$(WRAPPERS_OBJ)
20+
all: blob-stamper-alltest_dict$(WRAPPERS_OBJ)
2021
@echo All done!
2122

2223
blob-stamper-all:
@@ -40,3 +41,6 @@ clean: blob-stamper-clean
4041
test:
4142
$(MAKE) -C ttest
4243

44+
#test_dict: test_dict.o blob-stamper-all
45+
#$(CXX) $(LDFLAGS) $@.o -o $@ $(BLOB_STAMPER_OBJ)
46+

‎blobstamper/Makefile‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ ALL_OBJS = blob.o \
33
helpers.o\
44
stamp.o\
55
stamp_atomic.o\
6-
stamp_pg_type_geo.o
6+
stamp_pg_type_geo.o\
7+
dict.o
78

89

910
%.o:%.cpp$(DEPS)

‎blobstamper/dict.cpp‎

Lines changed: 294 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,294 @@
1+
#ifndef BLOB_H
2+
#defineBLOB_H
3+
4+
#include"dict.h"
5+
6+
7+
size_t
8+
DictBase::size()
9+
{
10+
return data.size();
11+
}
12+
13+
std::string
14+
DictBase::get(size_t n)
15+
{
16+
return data[n];
17+
}
18+
19+
20+
DictLCAlphaSmall::DictLCAlphaSmall()
21+
{
22+
/* List below was generated with following perl script
23+
24+
open(my $fh, "/usr/share/dict/british-english-small");
25+
my $i=0;
26+
while (my $s=<$fh>)
27+
{
28+
chomp $s;
29+
if ($s =~ /^[a-z]+$/)
30+
{
31+
print '"'.$s.'"'.",\n" if $i % 157 == 0;
32+
$i++;
33+
}
34+
}
35+
*/
36+
data = {
37+
"a",
38+
"abundances",
39+
"achieves",
40+
"adjunct",
41+
"affair",
42+
"aired",
43+
"ally",
44+
"amphitheatre",
45+
"annoyance",
46+
"appalled",
47+
"arbitrators",
48+
"artichokes",
49+
"assisting",
50+
"auctioneers",
51+
"awaked",
52+
"balanced",
53+
"barbiturates",
54+
"bawdier",
55+
"beggaring",
56+
"berserk",
57+
"biographies",
58+
"blazer",
59+
"blown",
60+
"bond",
61+
"boundless",
62+
"breaded",
63+
"broadsided",
64+
"buggy",
65+
"burping",
66+
"caches",
67+
"caned",
68+
"cards",
69+
"castoffs",
70+
"cellar",
71+
"chant",
72+
"cheetahs",
73+
"choral",
74+
"citizen",
75+
"cleft",
76+
"clues",
77+
"coined",
78+
"commanding",
79+
"competences",
80+
"concentrate",
81+
"configures",
82+
"conserve",
83+
"contemptuous",
84+
"convertors",
85+
"corpulent",
86+
"counterparts",
87+
"cranking",
88+
"crippled",
89+
"crusades",
90+
"cursing",
91+
"dams",
92+
"debate",
93+
"dedication",
94+
"deign",
95+
"denomination",
96+
"descents",
97+
"detonate",
98+
"differences",
99+
"dirt",
100+
"discouragement",
101+
"dismally",
102+
"dissented",
103+
"divested",
104+
"doorstep",
105+
"dread",
106+
"drunks",
107+
"dying",
108+
"edifices",
109+
"elegant",
110+
"emergency",
111+
"encyclopedia",
112+
"enshrine",
113+
"epitaph",
114+
"eternities",
115+
"excavates",
116+
"exists",
117+
"extends",
118+
"fact",
119+
"fashionably",
120+
"fellow",
121+
"fifteen",
122+
"firms",
123+
"flavourings",
124+
"floured",
125+
"followers",
126+
"forestalled",
127+
"fouler",
128+
"freshens",
129+
"fulfilling",
130+
"galaxy",
131+
"gaudier",
132+
"germs",
133+
"gleam",
134+
"godfather",
135+
"graffiti",
136+
"greened",
137+
"grouping",
138+
"gunshots",
139+
"halved",
140+
"harmonic",
141+
"headrest",
142+
"hems",
143+
"hims",
144+
"holy",
145+
"horrify",
146+
"humans",
147+
"hyphenates",
148+
"illustration",
149+
"impersonated",
150+
"inadequate",
151+
"increase",
152+
"industrious",
153+
"infuriate",
154+
"inquiry",
155+
"insulated",
156+
"intern",
157+
"intuitive",
158+
"irreverence",
159+
"jaws",
160+
"journals",
161+
"kegs",
162+
"kneecap",
163+
"lamentations",
164+
"launder",
165+
"lefts",
166+
"liberated",
167+
"lingoes",
168+
"lobes",
169+
"lords",
170+
"lushes",
171+
"maintaining",
172+
"mannequins",
173+
"mascot",
174+
"meadows",
175+
"men",
176+
"miaows",
177+
"minds",
178+
"misjudge",
179+
"modernise",
180+
"mop",
181+
"mourners",
182+
"muscles",
183+
"narrations",
184+
"neglects",
185+
"nightgowns",
186+
"nostalgia",
187+
"nymph",
188+
"oceans",
189+
"ooze",
190+
"ore",
191+
"outlasted",
192+
"overgrowing",
193+
"overwriting",
194+
"pamper",
195+
"pardon",
196+
"pastiche",
197+
"pearl",
198+
"people",
199+
"perplexity",
200+
"phenomenal",
201+
"pigged",
202+
"pivots",
203+
"pleasured",
204+
"pokers",
205+
"portables",
206+
"powders",
207+
"preface",
208+
"pretzels",
209+
"procedures",
210+
"prom",
211+
"protective",
212+
"puddles",
213+
"purr",
214+
"queasier",
215+
"racquets",
216+
"ranks",
217+
"readable",
218+
"receptionist",
219+
"recuperated",
220+
"refrigerate",
221+
"reiterate",
222+
"reminisces",
223+
"replenishes",
224+
"resemblances",
225+
"resulted",
226+
"reverenced",
227+
"ridiculing",
228+
"robots",
229+
"route",
230+
"rustlers",
231+
"salves",
232+
"savour",
233+
"schoolboy",
234+
"scrounging",
235+
"sedating",
236+
"separates",
237+
"shakiest",
238+
"shined",
239+
"shrewdness",
240+
"significance",
241+
"sitters",
242+
"slakes",
243+
"slogged",
244+
"smoothest",
245+
"snowfalls",
246+
"solidifies",
247+
"sow",
248+
"speeches",
249+
"spongiest",
250+
"squalled",
251+
"stammer",
252+
"stealthy",
253+
"stitches",
254+
"strangers",
255+
"stubbiest",
256+
"subside",
257+
"suitably",
258+
"supplemented",
259+
"swampiest",
260+
"sympathetically",
261+
"taken",
262+
"tattled",
263+
"temperate",
264+
"testicle",
265+
"thirteenths",
266+
"tickles",
267+
"tittered",
268+
"tormentors",
269+
"tragic",
270+
"trappings",
271+
"triggers",
272+
"trusty",
273+
"twigged",
274+
"unburdening",
275+
"undeserved",
276+
"unite",
277+
"unseemly",
278+
"upstream",
279+
"valved",
280+
"verbiage",
281+
"vindicating",
282+
"vortexes",
283+
"want",
284+
"waxes",
285+
"wets",
286+
"whom",
287+
"wipes",
288+
"woolliest",
289+
"wrinkles",
290+
"zanier"
291+
};
292+
}
293+
294+
#endif/* DICT_H*/

‎blobstamper/dict.h‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#include<string>
2+
#include<vector>
3+
4+
5+
classDictBase
6+
{
7+
protected:
8+
std::vector<std::string> data;
9+
public:
10+
size_tsize();
11+
std::stringget(size_t n);// FIXME May be it would be good to use operator[] later.
12+
DictBase() {data = {};};
13+
};
14+
15+
classDictLCAlphaSmall :publicDictBase
16+
{
17+
public:
18+
DictLCAlphaSmall();
19+
};

‎t/200-dict.cpp‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#include<string.h>
2+
3+
#include<exception>
4+
#include<string>
5+
#include<cstdlib>
6+
#defineWANT_TEST_EXTRAS
7+
#include<tap++/tap++.h>
8+
9+
#include"blobstamper/dict.h"
10+
11+
classDictTest :publicDictBase
12+
{
13+
public:
14+
DictTest();
15+
};
16+
17+
DictTest::DictTest()
18+
{
19+
data = {"one","two","three"};
20+
}
21+
22+
usingnamespaceTAP;
23+
24+
/* Test that dict works as expected*/
25+
26+
int
27+
main()
28+
{
29+
TEST_START(2);
30+
31+
{/* 1..2*/
32+
DictTest dict;
33+
ok(dict.size() ==3,"Dict size");
34+
ok(dict.get(1) =="two","Dict content");
35+
}
36+
37+
TEST_END;
38+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp