//
// Shared message catalog class for the CUPS PPD Compiler.
//
-// Copyright 2007-2008 by Apple Inc.
+// Copyright 2007-2009 by Apple Inc.
// Copyright 2002-2006 by Easy Software Products.
//
// These coded instructions, statements, and computer programs are the
//
// Contents:
//
+// ppdcCatalog::ppdcCatalog() - Create a shared message catalog.
+// ppdcCatalog::~ppdcCatalog() - Destroy a shared message catalog.
+// ppdcCatalog::add_message() - Add a new message.
+// ppdcCatalog::find_message() - Find a message in a catalog...
+// ppdcCatalog::load_messages() - Load messages from a .po file.
+// ppdcCatalog::save_messages() - Save the messages to a .po file.
+// get_utf8() - Get a UTF-8 character.
+// get_utf16() - Get a UTF-16 character...
+// put_utf8() - Add a UTF-8 character to a string.
+// put_utf16() - Write a UTF-16 character to a file.
//
//
// Include necessary headers...
//
-#include "ppdc.h"
-#include <cups/globals.h>
+#include "ppdc-private.h"
//
// Global information
+ PPDC_NEW;
+
locale = new ppdcString(l);
filename = new ppdcString(f);
messages = new ppdcArray();
ppdcCatalog::~ppdcCatalog()
{
- delete locale;
- delete filename;
- delete messages;
+ PPDC_DELETE;
+
+ locale->release();
+ filename->release();
+ messages->release();
}
string = text;
}
- messages->add(new ppdcMessage(id, text));
+ messages->add(new ppdcMessage(id, string));
}
{
// Add string...
add_message(id, str);
+ id[0] = '\0';
}
}
}
if ((ptr = (char *)strrchr(line, '\"')) == NULL)
{
_cupsLangPrintf(stderr,
- _("ERROR: Expected quoted string on line %d of %s!\n"),
+ _("ERROR: Expected quoted string on line %d of %s\n"),
linenum, f);
cupsFileClose(fp);
return (-1);
if ((ptr = strchr(line, '\"')) == NULL)
{
_cupsLangPrintf(stderr,
- _("ERROR: Expected quoted string on line %d of %s!\n"),
+ _("ERROR: Expected quoted string on line %d of %s\n"),
linenum, f);
cupsFileClose(fp);
return (-1);
{
_cupsLangPrintf(stderr,
_("ERROR: Need a msgid line before any "
- "translation strings on line %d of %s!\n"),
+ "translation strings on line %d of %s\n"),
linenum, f);
cupsFileClose(fp);
return (-1);
strlcat(id, ptr, sizeof(id));
else
{
- _cupsLangPrintf(stderr, _("ERROR: Unexpected text on line %d of %s!\n"),
+ _cupsLangPrintf(stderr, _("ERROR: Unexpected text on line %d of %s\n"),
linenum, f);
cupsFileClose(fp);
return (-1);
unknown_load_format:
_cupsLangPrintf(stderr,
- _("ERROR: Unknown message catalog format for \"%s\"!\n"), f);
+ _("ERROR: Unknown message catalog format for \"%s\"\n"), f);
cupsFileClose(fp);
return (-1);
}