[Kst] How to distinguish "top-level" strings from metadata strings?

Nicolas Brisset nicolas.brisset at free.fr
Fri Oct 5 23:10:18 UTC 2012


OK, I'm starting to get it. The patch below seems to do exactly what I want:

Index: src/libkstapp/document.cpp
===================================================================
--- src/libkstapp/document.cpp  (révision 1319250)
+++ src/libkstapp/document.cpp  (copie de travail)
@@ -148,7 +148,9 @@
     s->save(xml);
   }
   foreach (StringPtr s, objectStore()->getObjects<String>()) {
-    s->save(xml);
+    if (s->orphan()) {
+      s->save(xml);
+    }
   }
   xml.writeEndElement();

Can someone confirm that it's ok? Should we do the same for other primitives? 
Or make the change in the save() method in string_kst.cpp?

I think it's going to be a nice fix, i have files full of strings coming from ASCII headers or vector units. That'd be much cleaner.

Nicolas

----- Mail original -----
> De: "Nicolas Brisset" <nicolas.brisset at free.fr>
> À: "kst" <kst at kde.org>
> Envoyé: Samedi 6 Octobre 2012 00:50:09
> Objet: [Kst] How to distinguish "top-level" strings from metadata strings?
> 
> Hi,
> 
> I was trying to figure out how to avoid saving to the .kst file all
> the strings. I think strings created by the user should be saved
> (i.e. text labels and Create -> New String), but *not* datasource
> string metadata or other primitive metastrings.
> I am a bit confused by the various types of strings there are and the
> _orphan member. What would be the right way to determine whether a
> string should be saved?
> 
> Nicolas
> 
> P.S.: is there a way (doxygen or whatever) to visualize all the type
> hierarchies in an easy way?
> _______________________________________________
> Kst mailing list
> Kst at kde.org
> https://mail.kde.org/mailman/listinfo/kst
> 


More information about the Kst mailing list