File tree Expand file tree Collapse file tree 5 files changed +62
-0
lines changed Expand file tree Collapse file tree 5 files changed +62
-0
lines changed Original file line number Diff line number Diff line change 11
11
BLOBSTAMPER_SRC := $(wildcard blobstamper/* .cpp)
12
12
BLOBSTAMPER_OBJ := $(addsuffix .o, $(basename $(BLOBSTAMPER_SRC ) ) )
13
13
14
+ EXAMPLES_SRC = $(wildcard examples/* .cpp)
15
+ EXAMPLES_BIN = $(basename $(EXAMPLES_SRC ) )
16
+
17
+
14
18
.PHONY : all blob-stamper-all blob-stamper-clean clean test gagaga
15
19
16
20
all : $(BLOBSTAMPER_OBJ )
46
50
# test_dict: test_dict.o blob-stamper-all
47
51
# $(CXX) $(LDFLAGS) $@.o -o $@ $(BLOB_STAMPER_OBJ)
48
52
53
+ examples : $(BLOBSTAMPER_OBJ )
54
+ $(MAKE ) -C examples
49
55
50
56
gagaga :
51
57
@echo ------- $(BLOBSTAMPER_OBJ )
Original file line number Diff line number Diff line change @@ -111,3 +111,10 @@ Blob::asVector()
111
111
return res;
112
112
}
113
113
114
+ /* Do not use in prod. For tests and examples only */
115
+ std::string
116
+ Blob::asString ()
117
+ {
118
+ std::string res ((char *)data + begin, Size ());
119
+ return res;
120
+ }
Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ class Blob
42
42
std::vector<char > ChopBlank (StampBase &stmp);
43
43
void DataDup (char *& data_out, size_t & size_out);
44
44
std::vector<char > asVector ();
45
+ std::string asString (); /* Should not be used in prod, for tests and examples only*/
45
46
};
46
47
47
48
class OutOfData /* An exeption. Experemental for now*/
Original file line number Diff line number Diff line change
1
+
2
+ BLOBSTAMPER_SRC := $(wildcard ../blobstamper/* .cpp)
3
+ BLOBSTAMPER_OBJ := $(addsuffix .o, $(basename $(BLOBSTAMPER_SRC ) ) )
4
+
5
+ EXAMPLES_SRC = $(wildcard * .cpp)
6
+ EXAMPLES_BIN = $(basename $(EXAMPLES_SRC ) )
7
+
8
+
9
+ all : $(EXAMPLES_BIN )
10
+
11
+ build-libtappp :
12
+ $(MAKE ) -C ../libtappp
13
+
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
+
21
+ % : % .cpp $(BLOBSTAMPER_OBJ ) $(BLOBSTAMPER_PG_OBJ ) $(WRAPPERS_OBJ )
22
+ $(CXX ) $(CXXFLAGS ) -I.. -o $@ $< $(BLOBSTAMPER_OBJ )
23
+
24
+ clean :
25
+ -rm $(EXAMPLES_BIN ) 2> /dev/null
26
+
27
+ .PHONY : test clean all
28
+
Original file line number Diff line number Diff line change
1
+ #include < stdio.h>
2
+ #include < string.h>
3
+
4
+ #include < string>
5
+ #include < iostream>
6
+
7
+ #include < blobstamper/blobstamper.h>
8
+
9
+ int main ()
10
+ {
11
+ char data[] = " abcde" ;
12
+ Blob blob (data, strlen (data));
13
+ StampArithm<short int > stamp;
14
+ std::string s = stamp.ExtractStr (blob);
15
+
16
+ std::cout << " Stamp minSize: " << stamp.minSize () << " \n " ;
17
+ std::cout << " Stamp maxSize: " << stamp.maxSize () << " \n " ;
18
+ std::cout << " Extracted value: " << s <<" \n " ;
19
+ std::cout << " Remaining blob: " << blob.asString () << " \n " ;
20
+ }
You can’t perform that action at this time.
0 commit comments