nsAttrValue value; value.SetTo("example"); // Set value to "example" if (value.Type() == nsAttrValue::eString) { printf("Attribute value: %s\n", value.GetStringValue().get()); }
nsAttrValue value; value.SetTo(42); // Set value to integer 42 if (value.Type() == nsAttrValue::eInt32) { printf("Attribute value: %d\n", value.GetIntValue()); }This code example creates a new nsAttrValue object and initializes it with the integer 42. It then checks the type of the value and prints it out if it is an integer. The nsAttrValue class is part of the Mozilla Gecko engine, which is a web browser rendering engine. It is included in the gecko-dev package library.