Setting Text (>2048 length)

14 views
Skip to first unread message

Liam Crozier

unread,
Nov 22, 2017, 3:23:49 PM11/22/17
to spar...@googlegroups.com
Hello. 

I know how to set a string with value->SetString(L"hi"), but how to I set "Text"? I have a string greater than 2048 and I have set the attribute to 'Text' as well.


const attr_t edgeNodes = g->NewAttribute(newEdgeType, L"Nodes", Text, Basic);
....
g->SetAttribute(newEdge, a_childNodes, value->SetString(L"....4000 chars....));

Thank you.

UPDATE: I'm trying to use a TextStream but it is complaining that my type is "incomplete" :/

TextStream tstrm(false);

g->SetAttributeText(newEdge, a_childNodes, tstrm);
tstrm->Write(childNodes.c_str(), childNodes.size());
 

Liam Crozier

unread,
Nov 22, 2017, 4:11:01 PM11/22/17
to Sparksee
Managed to get it sorted. I forgot to include the Stream.h file. It would be nice to have a SetText method as there is a SetString, SetBoolean, etc...

----
const wstring childNodes = StringToWstring(cols[35]);
TextStream tstrm(false);
g->SetAttributeText(newEdge, a_childNodes, &tstrm);
tstrm.Write(childNodes.c_str(), childNodes.size());
tstrm.Close();

c3po.ac

unread,
Nov 23, 2017, 5:38:21 AM11/23/17
to Sparksee

Hi,


Having a SetText method would be helpful when you can write the full text with a single write operation. In fact, this was the original way to set a Text attribute but it was replaced with the current API, mostly because usually more than one write operation is required to set the value and we wanted to discourage the use of Text attributes in favour of String attributes, unless you really need them.


We will consider having the method back in future versions, thank you for your feedback.


Best regards



El dimecres, 22 novembre de 2017 22:11:01 UTC+1, Liam Crozier va escriure:

Liam Crozier

unread,
Nov 23, 2017, 9:35:57 AM11/23/17
to Sparksee
Thank you for the response. I'm really loving Sparksee! :)
Reply all
Reply to author
Forward
0 new messages