diff --git a/_build/usage_cpp_stl.html.erb b/_build/usage_cpp_stl.html.erb index fcd030354..0547b742d 100644 --- a/_build/usage_cpp_stl.html.erb +++ b/_build/usage_cpp_stl.html.erb @@ -11,21 +11,30 @@
-
#include <fstream>
+<%= code cur_lang, <<-CODE
+#include 
 
-std::ifstream is("path/to/local/file.<%= meta['file-extension'] || meta['id'] %>", std::ifstream::binary);
+std::ifstream is("path/to/local/file.#{meta['file-extension'] || meta['id']}", std::ifstream::binary); +CODE +%>
-
#include <sstream>
+<%= code cur_lang, <<-CODE
+#include 
 
-std::istringstream is(str);
+std::istringstream is(str); +CODE +%>
-
#include <sstream>
+<%= code cur_lang, <<-CODE
+#include 
 
 const char buf[] = { ... };
 std::string str(buf, sizeof buf);
-std::istringstream is(str);
+std::istringstream is(str); +CODE +%>
@@ -33,15 +42,29 @@ std::istringstream is(str);
  • We need to wrap our input stream into Kaitai stream: -
    #include <kaitai/kaitaistream.h>
    +<%= code cur_lang, <<-CODE
    +#include 
     
    -kaitai::kstream ks(&is);
  • +kaitai::kstream ks(&is); +CODE +%> +
  • And finally, we can invoke the parsing: - -
    <%= class_name %> data(&ks);
  • +<%= code cur_lang, <<-CODE +#{class_name} data(&ks); +CODE +%> +

    After that, one can get various attributes from the structure by invoking getter methods like:

    -
    <% usage_attrs.each { |attr| %>data.<%= attr[:name] %>() // => <%= attr[:doc] %><% } %>
    +<% src_usage_attrs = "" +usage_attrs.each { |attr| + src_usage_attrs += <<-CODE +data.#{ attr[:name] }() // => #{ attr[:doc] } + CODE +} +%> +<%= code cur_lang, src_usage_attrs %>