xref: /haiku/src/apps/icon-o-matic/document/savers/AttributeSaver.cpp (revision 774831e7c242f07168f07e1d804d93fe63687702)
1 /*
2  * Copyright 2006, Haiku. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Stephan Aßmus <superstippi@gmx.de>
7  */
8 
9 #include "AttributeSaver.h"
10 
11 #include <Node.h>
12 
13 #include "Document.h"
14 #include "FlatIconExporter.h"
15 
16 // constructor
AttributeSaver(const entry_ref & ref,const char * attrName)17 AttributeSaver::AttributeSaver(const entry_ref& ref, const char* attrName)
18 	: fRef(ref),
19 	  fAttrName(attrName)
20 {
21 }
22 
23 // destructor
~AttributeSaver()24 AttributeSaver::~AttributeSaver()
25 {
26 }
27 
28 // Save
29 status_t
Save(Document * document)30 AttributeSaver::Save(Document* document)
31 {
32 	BNode node(&fRef);
33 	FlatIconExporter iconExporter;
34 	return iconExporter.Export(document->Icon(), &node, fAttrName.String());
35 }
36 
37