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) (side-by-side diff)
tree9df6334cb1a61efebe68f7bcef9aa119a823626a /include/midillo/util.h
parent9bcc235e575a95989a5903394c127accbeef2e0f (diff)
downloadmidillo-0c21a7a0d5b84dc6726462f0fbe51b8c32433262.zip
midillo-0c21a7a0d5b84dc6726462f0fbe51b8c32433262.tar.gz
midillo-0c21a7a0d5b84dc6726462f0fbe51b8c32433262.tar.bz2
initial commit into repository0.0
Diffstat (limited to 'include/midillo/util.h') (more/less context) (show 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 @@
+#ifndef __MIDILLO_UTIL_H
+#define __MIDILLO_UTIL_H
+
+#include <istream>
+#include <ostream>
+
+/**
+ * @file
+ * @brief utilities
+ */
+
+namespace midillo {
+ using std::istream;
+ using std::ostream;
+
+ /**
+ * read 32 bits word from the stream
+ * @param s input stream
+ * @return the data acquired
+ */
+ unsigned long read32(istream& s);
+ /**
+ * read 16 bits word from the stream
+ * @param s input stream
+ * @return the data acquired
+ */
+ unsigned int read16(istream& s);
+ /**
+ * read the variable length quantity from the stream
+ * @param s input stream
+ * @return the data acquired
+ */
+ unsigned long readVL(istream& s);
+
+ /**
+ * write 32 bits word to the stream
+ * @param s output stream
+ * @param d data to write
+ */
+ void write32(ostream& s,unsigned long d);
+ /**
+ * write 16 bits word to the stream
+ * @param s output stream
+ * @param d data to write
+ */
+ void write16(ostream& s,unsigned int d);
+ /**
+ * write the variable length quantity to the stream
+ * @param s output stream
+ * @param d data to write
+ */
+ void writeVL(ostream& s,unsigned long d);
+
+ /**
+ * calculate the amount of data that would be written by writeVL
+ * @param d data that would be written
+ * @return the number of bytes
+ */
+ unsigned long calcVLsize(unsigned long d);
+
+}
+
+#endif /* __MIDILLO_UTIL_H */