Create a KeyView Session
To use the C++ Filter SDK, link the library built in Build the C++ API, and include the following headers in your code:
#include "Keyview_FilterSDK.hpp" #include "Keyview_IO.hpp"
To use the SDK, you must create a KeyView session:
auto KV = keyview::Session{license, bin_path};
bin_path
should be an std::string
that holds the location of the KeyView Filter SDK binaries.
The Session
class provides methods to detect, filter, get metatdata, and open container files. It also maintains a configuration state that can affect the behavior of the other API methods.
Configure your session
You can set additional optional configuration options by using the config()
method of the Session
object, which returns a reference to the active configuration. The following example provides a password for filtering password-protected files:
KV.config().password("myPassword");
You can also chain configuration options:
KV.config().password("abcde").hidden_text(true).header_and_footer(true);
The full set of configuration options you can set are documented in The Configuration Class.