Пример #1
0
	as_transform_member	get_transform_member(const tu_stringi& name)
	{
		if (s_transform_member_map.size() == 0)
		{
			s_transform_member_map.set_capacity(int(AS_TRANSFORM_MEMBER_COUNT));
			s_transform_member_map.add("colorTransform", colorTransform);
			s_transform_member_map.add("concatenatedColorTransform", concatenatedColorTransform);
			s_transform_member_map.add("matrix", matrix);
			s_transform_member_map.add("concatenatedMatrix", concatenatedMatrix);
			s_transform_member_map.add("pixelBounds", pixelBounds);
		}

		as_transform_member	result = invalidMember;
		s_transform_member_map.get(name, &result);

		return result;
	}
Пример #2
0
static const char* lookup_content_type(const char* file_extension)
// Given a file extension, determine the HTTP content type to return.
{
	static stringi_hash<const char*> s_types;
	static bool s_inited = false;
	if (!s_inited) {
		s_inited = true;

		// A small table of well-known content types.
		struct type_pair {
			const char* extension;
			const char* type;
		} types[] = {
			{ "txt", "text/plain" },
			{ "html", "text/html" },
			{ "htm", "text/html" },
			{ "jpg", "image/jpeg" },
			{ "jpeg", "image/jpeg" },
			{ "gif", "image/gif" },
			{ "png", "image/png" },
			{ "js", "text/javascript" },
			// etc.
		};

		// Register the types.
		for (int i = 0, n = TU_ARRAYSIZE(types); i < n; i++) {
			s_types.add(tu_stringi(types[i].extension), types[i].type);
		}
	}

	const char* type = NULL;
	if (s_types.get(tu_stringi(file_extension), &type)) {
		return type;
	}

	// No known type for this file extension.
	return "application/octet-stream";
}
Пример #3
0
as_standard_member	get_standard_member(const tu_stringi& name)
{
    if (s_standard_property_map.size() == 0)
    {
        s_standard_property_map.set_capacity(int(AS_STANDARD_MEMBER_COUNT));

        s_standard_property_map.add("_x", M_X);
        s_standard_property_map.add("_y", M_Y);
        s_standard_property_map.add("_xscale", M_XSCALE);
        s_standard_property_map.add("_yscale", M_YSCALE);
        s_standard_property_map.add("_currentframe", M_CURRENTFRAME);
        s_standard_property_map.add("_totalframes", M_TOTALFRAMES);
        s_standard_property_map.add("_alpha", M_ALPHA);
        s_standard_property_map.add("_visible", M_VISIBLE);
        s_standard_property_map.add("_width", M_WIDTH);
        s_standard_property_map.add("_height", M_HEIGHT);
        s_standard_property_map.add("_rotation", M_ROTATION);
        s_standard_property_map.add("_target", M_TARGET);
        s_standard_property_map.add("_framesloaded", M_FRAMESLOADED);
        s_standard_property_map.add("_name", M_NAME);
        s_standard_property_map.add("_droptarget", M_DROPTARGET);
        s_standard_property_map.add("_url", M_URL);
        s_standard_property_map.add("_highquality", M_HIGHQUALITY);
        s_standard_property_map.add("_focusrect", M_FOCUSRECT);
        s_standard_property_map.add("_soundbuftime", M_SOUNDBUFTIME);
        s_standard_property_map.add("_xmouse", M_XMOUSE);
        s_standard_property_map.add("_ymouse", M_YMOUSE);
        s_standard_property_map.add("_parent", M_PARENT);
        s_standard_property_map.add("text", M_TEXT);
        s_standard_property_map.add("textWidth", M_TEXTWIDTH);
        s_standard_property_map.add("textColor", M_TEXTCOLOR);
        s_standard_property_map.add("border", M_BORDER);
        s_standard_property_map.add("multiline", M_MULTILINE);
        s_standard_property_map.add("wordWrap", M_WORDWRAP);
        s_standard_property_map.add("type", M_TYPE);
        s_standard_property_map.add("backgroundColor", M_BACKGROUNDCOLOR);
        s_standard_property_map.add("_this", M_THIS);
        s_standard_property_map.add("this", MTHIS);
        s_standard_property_map.add("_root", M_ROOT);
        s_standard_property_map.add(".", MDOT);
        s_standard_property_map.add("..", MDOT2);
        s_standard_property_map.add("_level0", M_LEVEL0);
        s_standard_property_map.add("_global", M_GLOBAL);
        s_standard_property_map.add("enabled", M_ENABLED);
        s_standard_property_map.add("password", M_PASSWORD);
        s_standard_property_map.add("onMouseMove", M_MOUSE_MOVE);
    }

    as_standard_member	result = M_INVALID_MEMBER;
    s_standard_property_map.get(name, &result);

    return result;
}