summaryrefslogtreecommitdiffabout
path: root/include/midillo/util.h
authorMichael Krelin <hacker@klever.net>2006-08-11 16:01:56 (UTC)
committer Michael Krelin <hacker@klever.net>2006-08-11 16:01:56 (UTC)
commit0c21a7a0d5b84dc6726462f0fbe51b8c32433262 (patch) (unidiff)
tree9df6334cb1a61efebe68f7bcef9aa119a823626a /include/midillo/util.h
parent9bcc235e575a95989a5903394c127accbeef2e0f (diff)
downloadmidillo-0.0.zip
midillo-0.0.tar.gz
midillo-0.0.tar.bz2
initial commit into repository0.0
Diffstat (limited to 'include/midillo/util.h') (more/less context) (ignore whitespace changes)
-rw-r--r--include/midillo/util.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/include/midillo/util.h b/include/midillo/util.h
new file mode 100644
index 0000000..f9c8430
--- a/dev/null
+++ b/include/midillo/util.h
@@ -0,0 +1,63 @@
1#ifndef __MIDILLO_UTIL_H
2#define __MIDILLO_UTIL_H
3
4#include <istream>
5#include <ostream>
6
7/**
8 * @file
9 * @brief utilities
10 */
11
12namespace midillo {
13 using std::istream;
14 using std::ostream;
15
16 /**
17 * read 32 bits word from the stream
18 * @param s input stream
19 * @return the data acquired
20 */
21 unsigned long read32(istream& s);
22 /**
23 * read 16 bits word from the stream
24 * @param s input stream
25 * @return the data acquired
26 */
27 unsigned int read16(istream& s);
28 /**
29 * read the variable length quantity from the stream
30 * @param s input stream
31 * @return the data acquired
32 */
33 unsigned long readVL(istream& s);
34
35 /**
36 * write 32 bits word to the stream
37 * @param s output stream
38 * @param d data to write
39 */
40 void write32(ostream& s,unsigned long d);
41 /**
42 * write 16 bits word to the stream
43 * @param s output stream
44 * @param d data to write
45 */
46 void write16(ostream& s,unsigned int d);
47 /**
48 * write the variable length quantity to the stream
49 * @param s output stream
50 * @param d data to write
51 */
52 void writeVL(ostream& s,unsigned long d);
53
54 /**
55 * calculate the amount of data that would be written by writeVL
56 * @param d data that would be written
57 * @return the number of bytes
58 */
59 unsigned long calcVLsize(unsigned long d);
60
61}
62
63#endif /* __MIDILLO_UTIL_H */