Skip to content
This repository has been archived by the owner on Feb 17, 2024. It is now read-only.

Commit

Permalink
Merge pull request #63 from dium-li3/queries-cleanup
Browse files Browse the repository at this point in the history
Queries cleanup (again)
  • Loading branch information
voidbert authored Jan 23, 2024
2 parents 51e87a2 + 441ec28 commit 3a5c19d
Show file tree
Hide file tree
Showing 51 changed files with 1,772 additions and 1,644 deletions.
5 changes: 3 additions & 2 deletions trabalho-pratico/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# CONFIGURATION VARIABLES

CC := gcc
CFLAGS := -Wall -Wextra -Werror -pedantic -Iinclude $(shell pkg-config --cflags glib-2.0) \
$(shell pkg-config --cflags ncursesw)
CFLAGS := -Wall -Wextra -Werror -pedantic -Wshadow -Wcast-qual -Wwrite-strings \
-Wstrict-prototypes -Winit-self -Wfloat-equal -Iinclude $(shell pkg-config --cflags ncursesw) \
$(shell pkg-config --cflags glib-2.0)
STANDARDS := -std=c99 -D_POSIX_C_SOURCE=200809L
LIBS := -lm $(shell pkg-config --libs glib-2.0) $(shell pkg-config --libs ncursesw)

Expand Down
11 changes: 6 additions & 5 deletions trabalho-pratico/include/queries/q01.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/

/**
* @file q01.h
* @brief Implementation of query 1.
* @file q01.h
* @brief A query to provide information about an entity in the dataset.
*
* ### Examples
*
Expand Down Expand Up @@ -66,9 +66,10 @@
#include "queries/query_type.h"

/**
* @brief Initializes the definition of query 1.
* @details This is done automatically in ::query_type_list_create.
* @return A pointer to a `malloc`-allocated ::query_type_t on success, or `NULL` on failure.
* @brief Initializes the definition of queries of type 1.
* @details This is done automatically in [query_type_list](@ref query_type_list.c).
* @return On success, a pointer to a ::query_type_t that must be deleted with ::query_type_free,
* or `NULL` allocation on failure.
*/
query_type_t *q01_create(void);

Expand Down
10 changes: 5 additions & 5 deletions trabalho-pratico/include/queries/q02.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
*/

/**
* @file q02.h
* @brief A query to list flights / reservations related to a user.
* @details
* @file q02.h
* @brief A query to list flights / reservations related to a user.
*
* ### Examples
*
Expand All @@ -44,8 +43,9 @@

/**
* @brief Initializes the definition of the query of type 2.
* @details This is done automatically in ::query_type_list_create.
* @return A pointer to a `malloc`-allocated ::query_type_t on success, or `NULL` on failure.
* @details This is done automatically in [query_type_list](@ref query_type_list.c).
* @return On success, a pointer to a ::query_type_t that must be deleted with ::query_type_free,
* or `NULL` allocation on failure.
*/
query_type_t *q02_create(void);

Expand Down
11 changes: 6 additions & 5 deletions trabalho-pratico/include/queries/q03.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/

/**
* @file q03.h
* @brief A query to present the averate rating of an hotel, given its identifier.
* @file q03.h
* @brief A query that outputs the averate rating of an hotel, given its identifier.
*
* ### Examples
*
Expand All @@ -36,9 +36,10 @@
#include "queries/query_type.h"

/**
* @brief Initializes the definition of the third query.
* @details This is done automatically in ::query_type_list_create.
* @return A pointer to a `malloc`-allocated ::query_type_t on success, or `NULL` on failure.
* @brief Initializes the definition of queries of type 3.
* @details This is done automatically in [query_type_list](@ref query_type_list.c).
* @return On success, a pointer to a ::query_type_t that must be deleted with ::query_type_free,
* or `NULL` allocation on failure.
*/
query_type_t *q03_create(void);

Expand Down
67 changes: 33 additions & 34 deletions trabalho-pratico/include/queries/q04.h
Original file line number Diff line number Diff line change
@@ -1,47 +1,46 @@
/*
* Copyright 2023 Humberto Gomes, José Lopes, José Matos
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
* Copyright 2023 Humberto Gomes, José Lopes, José Matos
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* @file q04.h
* @brief List hotel reservations, ordered by start date (from most recent to oldest).
* @details If two reservations have the same date, the reservation identifier must
* be used as a tiebreaker (in ascending order).
*
* ### Examples
*
* ```text
* 4 HTL1001
* 4 HTL1002
* 4 HTL1003
* 4F HTL1001
* 4F HTL1002
* 4F HTL1003
* ```
*/
* @file q04.h
* @brief List all reservations of a given hotel.
*
* ### Examples
*
* ```text
* 4 HTL1001
* 4 HTL1002
* 4 HTL1003
* 4F HTL1001
* 4F HTL1002
* 4F HTL1003
* ```
*/

#ifndef Q04_H
#define Q04_H

#include "queries/query_type.h"

/**
* @brief Initializes the definition of the fourth query.
* @details This is done automatically in ::query_type_list_create.
* @return A pointer to a `malloc`-allocated ::query_type_t on success, or `NULL` on failure.
*/
* @brief Initializes the definition of queries of type 4.
* @details This is done automatically in [query_type_list](@ref query_type_list.c).
* @return On success, a pointer to a ::query_type_t that must be deleted with ::query_type_free,
* or `NULL` allocation on failure.
*/
query_type_t *q04_create(void);

#endif
7 changes: 4 additions & 3 deletions trabalho-pratico/include/queries/q05.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@
#include "queries/query_type.h"

/**
* @brief Initializes the definition of the fifth query.
* @details This is done automatically in ::query_type_list_init.
* @return A pointer to a `malloc`-allocated ::query_type_t on success, or `NULL` on failure.
* @brief Initializes the definition of queries of type 5.
* @details This is done automatically in [query_type_list](@ref query_type_list.c).
* @return On success, a pointer to a ::query_type_t that must be deleted with ::query_type_free,
* or `NULL` allocation on failure.
*/
query_type_t *q05_create(void);

Expand Down
68 changes: 33 additions & 35 deletions trabalho-pratico/include/queries/q06.h
Original file line number Diff line number Diff line change
@@ -1,48 +1,46 @@
/*
* Copyright 2023 Humberto Gomes, José Lopes, José Matos
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
* Copyright 2023 Humberto Gomes, José Lopes, José Matos
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* @file q06.h
* @brief List the top N airports with the most passengers, for a given year. Flights with an
* estimated departure date in that year must be counted.
* @details If two airports have the same value, the name of the airport must be used as a
* tiebreaker (in ascending order).
*
* ### Examples
*
* ```text
* 6 2023 10
* 6 2022 10
* 6 2021 10
* 6F 2023 10
* 6F 2022 10
* 6F 2021 10
* ```
*/
* @file q06.h
* @brief List the top N airports with the most passengers, for a given year.
*
* ### Examples
*
* ```text
* 6 2023 10
* 6 2022 10
* 6 2021 10
* 6F 2023 10
* 6F 2022 10
* 6F 2021 10
* ```
*/

#ifndef Q06_H
#define Q06_H

#include "queries/query_type.h"

/**
* @brief Initializes the definition of the sixth query.
* @details This is done automatically in ::query_type_list_create.
* @return A pointer to a `malloc`-allocated ::query_type_t on success, or `NULL` on failure.
*/
* @brief Initializes the definition of queries of type 6.
* @details This is done automatically in [query_type_list](@ref query_type_list.c).
* @return On success, a pointer to a ::query_type_t that must be deleted with ::query_type_free,
* or `NULL` allocation on failure.
*/
query_type_t *q06_create(void);

#endif
62 changes: 31 additions & 31 deletions trabalho-pratico/include/queries/q07.h
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
/*
* Copyright 2023 Humberto Gomes, José Lopes, José Matos
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
* Copyright 2023 Humberto Gomes, José Lopes, José Matos
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* @file q07.h
* @brief A query to that lists the top N airports by median of departure delays.
* @details
*
* ### Examples
*
* ```text
* 7 10
* 7 20
* 7F 10
* 7F 20
* ```
*/
* @file q07.h
* @brief A query to that lists the top N airports by median of departure delays.
*
* ### Examples
*
* ```text
* 7 10
* 7 20
* 7F 10
* 7F 20
* ```
*/

#ifndef Q07_H
#define Q07_H

#include "queries/query_type.h"

/**
* @brief Initializes the definition of the seventh query.
* @details This is done automatically in ::query_type_list_create.
* @return A pointer to a `malloc`-allocated ::query_type_t on success, or `NULL` on failure.
*/
* @brief Initializes the definition of queries of type 7.
* @details This is done automatically in [query_type_list](@ref query_type_list.c).
* @return On success, a pointer to a ::query_type_t that must be deleted with ::query_type_free,
* or `NULL` allocation on failure.
*/
query_type_t *q07_create(void);

#endif
Loading

0 comments on commit 3a5c19d

Please sign in to comment.