openldev/openldev-utils.h File Reference

Utility Functions. More...

#include <gtksourceview/gtksourceview.h>
#include <gtk/gtk.h>
#include <glib.h>
#include <iostream>
#include <fstream>

Functions

string openldev_add_prefix (string file)
void openldev_error (string message)
gboolean openldev_question (string message)
void openldev_write_file (string file, string text)
string openldev_read_file (string file)
gboolean openldev_is_error_or_warning (string output)
int openldev_get_file_name_and_line (string &output)
void openldev_add_new_stock_item (GtkIconFactory *icon_factory, gchar *name, gchar *id, gchar *file)
gint openldev_fork_new_process (string command)
string openldev_file_get_text_in_buffer (GtkSourceBuffer *buffer)


Detailed Description


Function Documentation

void openldev_add_new_stock_item GtkIconFactory *  icon_factory,
gchar *  name,
gchar *  id,
gchar *  file
 

Add a new stock menu item. These can be used in menus, toolbars or popup menus.

Parameters:
icon_factory The stock item is added to this GtkIconFactory.
name Text displayed beside the stock image.
id Access id that will be used when referencing the stock item.
file Full location of the image.

string openldev_add_prefix string  file  ) 
 

Add INSTALL_PREFIX to the beginning of the string. This is so the user can define custom install prefixes.

Parameters:
file File name that INSTALL_PREFIX should be added to.
Returns:
The full file name the prefix was attached to.

void openldev_error string  message  ) 
 

Give the user a message. There is no need to add newline characters because the message will wrap automatically. The message also supports Pango formatting.

Parameters:
message The text that should be shown in the dialog.

string openldev_file_get_text_in_buffer GtkSourceBuffer *  buffer  ) 
 

Retrive all of the text in the specified buffer. This has to be a GtkSourceBuffer to use.

Parameters:
buffer A GtkSourceBuffer that the text is in.
Returns:
The text in the buffer.

gint openldev_fork_new_process string  command  ) 
 

Create a new process using fork() and execl(). This can be done with any arbitrary command and the forked application will not affect the operation of OpenLDev.

Parameters:
command The command that is to be run.
Returns:
The process id or -1 if the fork was unsuccessful.

int openldev_get_file_name_and_line string &  output  ) 
 

Get the line number the error or warning is on and what file it is from.

Parameters:
output The build output string, which is converted just to the short file name.
Returns:
The line number where the error or warning occurred.

gboolean openldev_is_error_or_warning string  output  ) 
 

You can use this function to check whether the line of make output is an error or a warning.

Parameters:
output The build output string. This should only be one line long.
Returns:
TRUE if the build output line is an error or a warning.

gboolean openldev_question string  message  ) 
 

Ask the user a question, specified by your message. The user's choice is returned from the

Parameters:
message The question that is to be shown in the dialog.
Returns:
TRUE if the Yes button was pressed.

string openldev_read_file string  file  ) 
 

Read the contents of a file. This function uses GLib functions to verify that the file exists.

Parameters:
file Full location where the file is located.
Returns:
Text content of the file.

void openldev_write_file string  file,
string  text
 

Write text to a file. This uses the standard C++ ofstream functions.

Parameters:
file Full location where the file is located.
text Text that should be written to the file.


Generated on Sun May 14 14:57:41 2006 for OpenLDev by  doxygen 1.4.6