xattr: list attribute names without the namespace prefix 'user.' v_0
authorFrantišek Kučera <franta-hg@frantovo.cz>
Tue, 26 Dec 2023 15:41:07 +0100
branchv_0
changeset 27 2a156cb51479
parent 26 e7ceb915177e
child 28 4cbd9c0beb4c
xattr: list attribute names without the namespace prefix 'user.'
Shark.cpp
XAttrs.cpp
--- a/Shark.cpp	Tue Dec 26 12:40:20 2023 +0100
+++ b/Shark.cpp	Tue Dec 26 15:41:07 2023 +0100
@@ -466,13 +466,9 @@
 	// glBindVertexArray(vao);
 
 	glm::mat4 model = glm::mat4(1.0f); // identity matrix
-	// model = glm::translate(model, glm::vec3(0., 0., 0.));
-	// float angle = 20.0f;
-	// glm::vec3 xxx = glm::vec3(1.0f, 0.3f, 0.5f);
-	// model = glm::rotate(model, glm::radians(angle), xxx);
 	glUniformMatrix4fv(ProgAttr.uModel, 1, GL_FALSE, &model[0][0]);
 
-	glDrawArrays(GL_TRIANGLES, 0, 2 * 3); // viz loadVertices() kde plníme data
+	glDrawArrays(GL_TRIANGLES, 0, 2 * 3); // see loadVertices()
 	std::cerr << "GLSL: glDrawArrays()" << std::endl;
 }
 
@@ -580,7 +576,7 @@
 		watchedFiles.push_back(fileMonitor.watch(tex.fileName));
 		// TODO: review texture loading and binding
 		// works even without this - default texture
-		// glUniform1i(ProgAttr.jazz, jazz);
+		// glUniform1i(..., ...);
 		// checkError(&std::cerr);
 	}
 }
@@ -607,7 +603,6 @@
 		glBindVertexArray(vao);
 		// VAO - something like context for bound data/variables
 		// We can switch multiple VAOs. VAO can contain multiple VBOs.
-		// See also https://stackoverflow.com/questions/11821336/
 		// what-are-vertex-array-objects
 
 		// Vertex Buffer Object (VBO):
--- a/XAttrs.cpp	Tue Dec 26 12:40:20 2023 +0100
+++ b/XAttrs.cpp	Tue Dec 26 15:41:07 2023 +0100
@@ -138,13 +138,15 @@
 	if (reload || !impl->loaded) {
 		impl->attributes.clear();
 		std::vector<std::string> names = xattrList(impl->fileName);
-		// FIXME: remove nameSpace
+		const std::string prefix = impl->nameSpace + ".";
 		for (const std::string& name : names) {
-			Attribute a;
-			a.impl->xattrs = impl;
-			a.impl->name = name;
-			a.impl->value = xattrGet(impl->fileName, name, &a.impl->exists);
-			impl->attributes.push_back(a);
+			if (name.starts_with(prefix)) {
+				Attribute a;
+				a.impl->xattrs = impl;
+				a.impl->name = name.substr(prefix.size());
+				a.impl->value = xattrGet(impl->fileName, name, &a.impl->exists);
+				impl->attributes.push_back(a);
+			}
 		}
 		impl->loaded = true;
 	}