![]() |
![]() |
![]() |
LibJClass Reference Manual | |
---|---|---|---|---|
Top | Description |
#include <jclass/manifest.h> Manifest; ManifestSection; ManifestEntry; Manifest * jclass_manifest_new_from_buffer (const char *buf, uint32_t length); void jclass_manifest_free (Manifest *manifest); const char * jclass_manifest_get_entry (Manifest *manifest, const char *section_name, const char *key);
Manifest files are used in jar files to set various attributes for the jar file or individual classes.
typedef struct { int section_count; ManifestSection *sections; } Manifest;
The top-level structure for a manifest. It contains the various sections for the manifest.
int |
Number of sections in the manifest. |
ManifestSection * |
An array with the sections in the manifest. |
typedef struct { char *name; int entry_count; ManifestEntry *entries; } ManifestSection;
A section in a manifest typically represents attributes for a single class. The NULL section represents attributes for all classes and resources.
char * |
The name for the section. The main section has a NULL name. |
int |
The number of entries in the section. |
ManifestEntry * |
An array with the entries in the section. |
typedef struct { char *key; char *value; } ManifestEntry;
A manifest entry is a key-value pair. The key is the name of the attribute and value is the value. The current parser is rather limited because it doesn't support multi-line values. Only the first line is returned.
char * |
The name of the entry. |
char * |
The value of the entry. |
Manifest * jclass_manifest_new_from_buffer (const char *buf, uint32_t length);
Creates a Manifest struct representing the given memory buffer. If the length given is 0 it is assumed that the buffer is NULL terminated.
|
A memory buffer containing a manifest file. |
|
The length of the buffer in bytes. If the buffer is NULL terminated set to 0. |
Returns : |
A Manifest struct or NULL if something went wrong. |
void jclass_manifest_free (Manifest *manifest);
Frees the given manifest structure.
|
The manifest to free. |
const char * jclass_manifest_get_entry (Manifest *manifest, const char *section_name, const char *key);
Gets the value of the given entry from a manifest.
|
The manifest to get the entry from. |
|
The name of the section containing the entry or NULL for the main section. |
|
The name of the entry. |
Returns : |
A NULL terminated string you should not modify. |