1/* -*- Mode: vala; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- 2 * 3 * Copyright © 2014 Nikhar Agrawal 4 * 5 * This file is part of libgnome-games-support. 6 * 7 * libgnome-games-support is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU Lesser General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * libgnome-games-support is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU Lesser General Public License for more details. 16 * 17 * You should have received a copy of the GNU Lesser General Public License 18 * along with libgnome-games-support. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 21namespace Games { 22namespace Scores { 23 24public class Category : Object 25{ 26 private string _key; 27 public string key 28 { 29 get { return _key; } 30 set 31 { 32 for (int i = 0; value[i] != '\0'; i++) 33 { 34 if (!value[i].isalnum () && value[i] != '-' && value[i] != '_') 35 { 36 error ("Category keys may contain only hyphens, underscores, and alphanumeric characters."); 37 } 38 } 39 _key = value; 40 } 41 } 42 43 /* This is a user-friendly name. It should be marked for translation. */ 44 public string name { get; set; } 45 46 public Category (string key, string name) 47 { 48 Object (key: key, name: name); 49 } 50} 51 52} /* namespace Scores */ 53} /* namespace Games */ 54