mirror of
https://github.com/Artikash/Example-Extension.git
synced 2024-11-23 09:35:37 +08:00
new api
This commit is contained in:
parent
4647a78456
commit
c7567885e7
@ -5,20 +5,20 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
struct InfoForExtension
|
struct InfoForExtension
|
||||||
{
|
{
|
||||||
const char* name;
|
const char* name;
|
||||||
int64_t value;
|
int64_t value;
|
||||||
InfoForExtension* next;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SentenceInfo
|
struct SentenceInfo
|
||||||
{
|
{
|
||||||
const InfoForExtension* list;
|
const InfoForExtension* infoArray;
|
||||||
// Traverse linked list to find info.
|
// nullptr marks end of info array
|
||||||
int64_t operator[](std::string propertyName)
|
int64_t operator[](std::string propertyName)
|
||||||
{
|
{
|
||||||
for (auto i = list; i != nullptr; i = i->next) if (propertyName == i->name) return i->value;
|
for (auto info = infoArray; info->name != nullptr; ++info) if (propertyName == info->name) return info->value;
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -5,9 +5,9 @@ bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo);
|
|||||||
/**
|
/**
|
||||||
* You shouldn't mess with this or even look at it unless you're certain you know what you're doing.
|
* You shouldn't mess with this or even look at it unless you're certain you know what you're doing.
|
||||||
* Param sentence: pointer to sentence received by Textractor (UTF-16).
|
* Param sentence: pointer to sentence received by Textractor (UTF-16).
|
||||||
* You should not modify this sentence. If you want Textractor to receive a modified sentence, copy it into your own buffer and return that.
|
* You should not write beyond the end of this sentence. If you want Textractor to receive a larger sentence, copy it into your own buffer and return that.
|
||||||
* Please allocate the buffer using HeapAlloc() and not new[] or malloc() or something else: Textractor uses HeapFree() to free it.
|
* Please allocate the buffer using HeapAlloc() and not new[] or malloc() or something else: Textractor uses HeapFree() to free it.
|
||||||
* Param miscInfo: pointer to start of singly linked list containing misc info about the sentence.
|
* Param miscInfo: pointer to array containing misc info about the sentence. End of array is marked with name being nullptr.
|
||||||
* Return value: pointer to sentence Textractor takes for future processing and display. If nullptr, Textractor will destroy the sentence.
|
* Return value: pointer to sentence Textractor takes for future processing and display. If nullptr, Textractor will destroy the sentence.
|
||||||
* Return 'sentence' unless you created a new sentence/buffer as mentioned above.
|
* Return 'sentence' unless you created a new sentence/buffer as mentioned above.
|
||||||
* Textractor will display the sentence after all extensions have had a chance to process and/or modify it.
|
* Textractor will display the sentence after all extensions have had a chance to process and/or modify it.
|
||||||
|
Loading…
Reference in New Issue
Block a user